zwischenspeicherung
This commit is contained in:
parent
48b556057c
commit
494d9822ba
|
|
@ -16,92 +16,102 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module mod_vtm_aufbau
|
module mod_vtm
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
export module mod_aufbau
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export type typ_akzeptoraufgabe =
|
|
||||||
{
|
{
|
||||||
id : string;
|
|
||||||
titel : string;
|
export module mod_akzeptoraufgabe
|
||||||
text : string;
|
{
|
||||||
tests : Array<typ_akzeptortest>;
|
|
||||||
}
|
/**
|
||||||
;
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export type typ_akzeptoraufgabe =
|
||||||
/**
|
{
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
id : string;
|
||||||
*/
|
titel : string;
|
||||||
export function akzeptoraufgabe_erstellen
|
text : string;
|
||||||
(
|
tests : Array<mod_akzeptortest.typ_akzeptortest>;
|
||||||
id : string,
|
}
|
||||||
titel : string,
|
;
|
||||||
text : string,
|
|
||||||
tests : Array<typ_akzeptortest>
|
|
||||||
)
|
/**
|
||||||
: typ_akzeptoraufgabe
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
{
|
*/
|
||||||
return {
|
export function erstellen
|
||||||
"id": id,
|
(
|
||||||
"titel": titel,
|
id : string,
|
||||||
"text": text,
|
titel : string,
|
||||||
"tests": tests,
|
text : string,
|
||||||
};
|
tests : Array<mod_akzeptortest.typ_akzeptortest>
|
||||||
}
|
)
|
||||||
|
: typ_akzeptoraufgabe
|
||||||
|
{
|
||||||
/**
|
return {
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
"id": id,
|
||||||
*/
|
"titel": titel,
|
||||||
export function akzeptoraufgabe_id
|
"text": text,
|
||||||
(
|
"tests": tests,
|
||||||
akzeptoraufgabe : typ_akzeptoraufgabe
|
};
|
||||||
)
|
}
|
||||||
: string
|
|
||||||
{
|
|
||||||
return akzeptoraufgabe.id;
|
/**
|
||||||
}
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function id
|
||||||
/**
|
(
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
akzeptoraufgabe : typ_akzeptoraufgabe
|
||||||
*/
|
)
|
||||||
export function akzeptoraufgabe_titel
|
: string
|
||||||
(
|
{
|
||||||
akzeptoraufgabe : typ_akzeptoraufgabe
|
return akzeptoraufgabe.id;
|
||||||
)
|
}
|
||||||
: string
|
|
||||||
{
|
|
||||||
return akzeptoraufgabe.titel;
|
/**
|
||||||
}
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function titel
|
||||||
/**
|
(
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
akzeptoraufgabe : typ_akzeptoraufgabe
|
||||||
*/
|
)
|
||||||
export function akzeptoraufgabe_text
|
: string
|
||||||
(
|
{
|
||||||
akzeptoraufgabe : typ_akzeptoraufgabe
|
return akzeptoraufgabe.titel;
|
||||||
)
|
}
|
||||||
: string
|
|
||||||
{
|
|
||||||
return akzeptoraufgabe.text;
|
/**
|
||||||
}
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function text
|
||||||
/**
|
(
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
akzeptoraufgabe : typ_akzeptoraufgabe
|
||||||
*/
|
)
|
||||||
export function akzeptoraufgabe_tests
|
: string
|
||||||
(
|
{
|
||||||
akzeptoraufgabe : typ_akzeptoraufgabe
|
return akzeptoraufgabe.text;
|
||||||
)
|
}
|
||||||
: Array<typ_akzeptortest>
|
|
||||||
{
|
|
||||||
return akzeptoraufgabe.tests;
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function tests
|
||||||
|
(
|
||||||
|
akzeptoraufgabe : typ_akzeptoraufgabe
|
||||||
|
)
|
||||||
|
: Array<mod_akzeptortest.typ_akzeptortest>
|
||||||
|
{
|
||||||
|
return akzeptoraufgabe.tests;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,62 +16,72 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module mod_vtm_aufbau
|
module mod_vtm
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
export module mod_aufbau
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export type typ_akzeptortest =
|
|
||||||
{
|
{
|
||||||
eingabe : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>;
|
|
||||||
annehmen : boolean;
|
export module mod_akzeptortest
|
||||||
}
|
{
|
||||||
;
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
/**
|
*/
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
export type typ_akzeptortest =
|
||||||
*/
|
{
|
||||||
export function akzeptortest_erstellen
|
eingabe : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>;
|
||||||
(
|
annehmen : boolean;
|
||||||
eingabe : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>,
|
}
|
||||||
annehmen : boolean
|
;
|
||||||
)
|
|
||||||
: typ_akzeptortest
|
|
||||||
{
|
/**
|
||||||
return {
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
"eingabe": eingabe,
|
*/
|
||||||
"annehmen": annehmen,
|
export function erstellen
|
||||||
};
|
(
|
||||||
}
|
eingabe : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>,
|
||||||
|
annehmen : boolean
|
||||||
|
)
|
||||||
/**
|
: typ_akzeptortest
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
{
|
||||||
*/
|
return {
|
||||||
export function akzeptortest_eingabe
|
"eingabe": eingabe,
|
||||||
(
|
"annehmen": annehmen,
|
||||||
akzeptortest : typ_akzeptortest
|
};
|
||||||
)
|
}
|
||||||
: Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>
|
|
||||||
{
|
|
||||||
return akzeptortest.eingabe;
|
/**
|
||||||
}
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function eingabe
|
||||||
/**
|
(
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
akzeptortest : typ_akzeptortest
|
||||||
*/
|
)
|
||||||
export function akzeptortest_pruefen
|
: Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>
|
||||||
(
|
{
|
||||||
akzeptortest : typ_akzeptortest,
|
return akzeptortest.eingabe;
|
||||||
angenommen : boolean,
|
}
|
||||||
ausgabe : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>
|
|
||||||
)
|
|
||||||
: boolean
|
/**
|
||||||
{
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
return (akzeptortest.annehmen === angenommen);
|
*/
|
||||||
|
export function pruefen
|
||||||
|
(
|
||||||
|
akzeptortest : typ_akzeptortest,
|
||||||
|
angenommen : boolean,
|
||||||
|
ausgabe : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>
|
||||||
|
)
|
||||||
|
: boolean
|
||||||
|
{
|
||||||
|
return (akzeptortest.annehmen === angenommen);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,197 +16,207 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module mod_vtm_aufbau
|
module mod_vtm
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
export module mod_aufbau
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export type typ_aufgabe = typ_komplex<Object>;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
var _liste : Array<typ_aufgabe> = [];
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function aufgabe_id
|
|
||||||
(
|
|
||||||
aufgabe : typ_aufgabe
|
|
||||||
)
|
|
||||||
: string
|
|
||||||
{
|
{
|
||||||
return (
|
|
||||||
fallunterscheidung<string>
|
export module mod_aufgabe
|
||||||
(
|
|
||||||
aufgabe,
|
|
||||||
{
|
|
||||||
"akzeptoraufgabe": (angaben) => akzeptoraufgabe_id(angaben),
|
|
||||||
"transduktoraufgabe": (angaben) => transduktoraufgabe_id(angaben),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function aufgabe_titel
|
|
||||||
(
|
|
||||||
aufgabe : typ_aufgabe
|
|
||||||
)
|
|
||||||
: string
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
fallunterscheidung<string>
|
|
||||||
(
|
|
||||||
aufgabe,
|
|
||||||
{
|
|
||||||
"akzeptoraufgabe": (angaben) => akzeptoraufgabe_titel(angaben),
|
|
||||||
"transduktoraufgabe": (angaben) => transduktoraufgabe_titel(angaben),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function aufgabe_text
|
|
||||||
(
|
|
||||||
aufgabe : typ_aufgabe
|
|
||||||
)
|
|
||||||
: string
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
fallunterscheidung<string>
|
|
||||||
(
|
|
||||||
aufgabe,
|
|
||||||
{
|
|
||||||
"akzeptoraufgabe": (angaben) => akzeptoraufgabe_text(angaben),
|
|
||||||
"transduktoraufgabe": (angaben) => transduktoraufgabe_text(angaben),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function aufgabe_tests
|
|
||||||
(
|
|
||||||
aufgabe : typ_aufgabe
|
|
||||||
)
|
|
||||||
: Array<typ_test>
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
fallunterscheidung<Array<typ_test>>
|
|
||||||
(
|
|
||||||
aufgabe,
|
|
||||||
{
|
|
||||||
"akzeptoraufgabe": (angaben) => (
|
|
||||||
akzeptoraufgabe_tests(angaben)
|
|
||||||
.map(angaben_ => ({"art": "akzeptortest", "angaben": angaben_}))
|
|
||||||
),
|
|
||||||
"transduktoraufgabe": (angaben) => (
|
|
||||||
transduktoraufgabe_tests(angaben)
|
|
||||||
.map(angaben_ => ({"art": "transduktortest", "angaben": angaben_}))
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function aufgabe_importieren(aufgabe_roh : any) : typ_aufgabe
|
|
||||||
{
|
|
||||||
switch (aufgabe_roh["art"])
|
|
||||||
{
|
{
|
||||||
case "akzeptor":
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export type typ_aufgabe = typ_komplex<Object>;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
var _liste : Array<typ_aufgabe> = [];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function id
|
||||||
|
(
|
||||||
|
aufgabe : typ_aufgabe
|
||||||
|
)
|
||||||
|
: string
|
||||||
{
|
{
|
||||||
return {
|
return (
|
||||||
"art": "akzeptoraufgabe",
|
fallunterscheidung<string>
|
||||||
"angaben": (
|
(
|
||||||
akzeptoraufgabe_erstellen
|
aufgabe,
|
||||||
(
|
{
|
||||||
aufgabe_roh["id"],
|
"akzeptoraufgabe": (angaben) => mod_akzeptoraufgabe.id(angaben),
|
||||||
aufgabe_roh["parameter"]["titel"],
|
"transduktoraufgabe": (angaben) => mod_transduktoraufgabe.id(angaben),
|
||||||
aufgabe_roh["parameter"]["text"],
|
}
|
||||||
aufgabe_roh["parameter"]["tests"].map
|
)
|
||||||
(
|
);
|
||||||
test_roh => (
|
}
|
||||||
akzeptortest_erstellen
|
|
||||||
(
|
|
||||||
test_roh["eingabe"],
|
/**
|
||||||
test_roh["annehmen"]
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
)
|
*/
|
||||||
)
|
export function titel
|
||||||
|
(
|
||||||
|
aufgabe : typ_aufgabe
|
||||||
|
)
|
||||||
|
: string
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
fallunterscheidung<string>
|
||||||
|
(
|
||||||
|
aufgabe,
|
||||||
|
{
|
||||||
|
"akzeptoraufgabe": (angaben) => mod_akzeptoraufgabe.titel(angaben),
|
||||||
|
"transduktoraufgabe": (angaben) => mod_transduktoraufgabe.titel(angaben),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function text
|
||||||
|
(
|
||||||
|
aufgabe : typ_aufgabe
|
||||||
|
)
|
||||||
|
: string
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
fallunterscheidung<string>
|
||||||
|
(
|
||||||
|
aufgabe,
|
||||||
|
{
|
||||||
|
"akzeptoraufgabe": (angaben) => mod_akzeptoraufgabe.text(angaben),
|
||||||
|
"transduktoraufgabe": (angaben) => mod_transduktoraufgabe.text(angaben),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function tests
|
||||||
|
(
|
||||||
|
aufgabe : typ_aufgabe
|
||||||
|
)
|
||||||
|
: Array<mod_test.typ_test>
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
fallunterscheidung<Array<mod_test.typ_test>>
|
||||||
|
(
|
||||||
|
aufgabe,
|
||||||
|
{
|
||||||
|
"akzeptoraufgabe": (angaben) => (
|
||||||
|
mod_akzeptoraufgabe.tests(angaben)
|
||||||
|
.map(angaben_ => ({"art": "akzeptortest", "angaben": angaben_}))
|
||||||
|
),
|
||||||
|
"transduktoraufgabe": (angaben) => (
|
||||||
|
mod_transduktoraufgabe.tests(angaben)
|
||||||
|
.map(angaben_ => ({"art": "transduktortest", "angaben": angaben_}))
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function importieren(aufgabe_roh : any) : typ_aufgabe
|
||||||
|
{
|
||||||
|
switch (aufgabe_roh["art"])
|
||||||
|
{
|
||||||
|
case "akzeptor":
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
"art": "akzeptoraufgabe",
|
||||||
|
"angaben": (
|
||||||
|
mod_akzeptoraufgabe.erstellen
|
||||||
|
(
|
||||||
|
aufgabe_roh["id"],
|
||||||
|
aufgabe_roh["parameter"]["titel"],
|
||||||
|
aufgabe_roh["parameter"]["text"],
|
||||||
|
aufgabe_roh["parameter"]["tests"].map
|
||||||
|
(
|
||||||
|
test_roh => (
|
||||||
|
mod_akzeptortest.erstellen
|
||||||
|
(
|
||||||
|
test_roh["eingabe"],
|
||||||
|
test_roh["annehmen"]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
};
|
||||||
)
|
break;
|
||||||
};
|
}
|
||||||
break;
|
case "transduktor":
|
||||||
}
|
{
|
||||||
case "transduktor":
|
return {
|
||||||
{
|
"art": "transduktoraufgabe",
|
||||||
return {
|
"angaben": (
|
||||||
"art": "transduktoraufgabe",
|
mod_transduktoraufgabe.erstellen
|
||||||
"angaben": (
|
(
|
||||||
transduktoraufgabe_erstellen
|
aufgabe_roh["id"],
|
||||||
(
|
aufgabe_roh["parameter"]["titel"],
|
||||||
aufgabe_roh["id"],
|
aufgabe_roh["parameter"]["text"],
|
||||||
aufgabe_roh["parameter"]["titel"],
|
aufgabe_roh["parameter"]["tests"].map
|
||||||
aufgabe_roh["parameter"]["text"],
|
(
|
||||||
aufgabe_roh["parameter"]["tests"].map
|
test_roh => (
|
||||||
(
|
mod_transduktortest.erstellen
|
||||||
test_roh => (
|
(
|
||||||
transduktortest_erstellen
|
test_roh["eingabe"],
|
||||||
(
|
test_roh["ausgabe"]
|
||||||
test_roh["eingabe"],
|
)
|
||||||
test_roh["ausgabe"]
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
};
|
||||||
)
|
break;
|
||||||
};
|
}
|
||||||
break;
|
default:
|
||||||
|
{
|
||||||
|
let meldung : string = "unbehandelte Art";
|
||||||
|
throw (new Error(meldung));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function registrieren(aufgabe : typ_aufgabe) : void
|
||||||
{
|
{
|
||||||
let meldung : string = "unbehandelte Art";
|
_liste.push(aufgabe);
|
||||||
throw (new Error(meldung));
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function holen(index : int) : typ_aufgabe
|
||||||
|
{
|
||||||
|
return _liste[index];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function aufgabe_registrieren(aufgabe : typ_aufgabe) : void
|
|
||||||
{
|
|
||||||
_liste.push(aufgabe);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function aufgabe_holen(index : int) : typ_aufgabe
|
|
||||||
{
|
|
||||||
return _liste[index];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,106 +16,116 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module mod_vtm_aufbau
|
module mod_vtm
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
export module mod_aufbau
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export type typ_test = typ_komplex<Object>;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function test_eingabe
|
|
||||||
(
|
|
||||||
test : typ_test
|
|
||||||
)
|
|
||||||
: Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>
|
|
||||||
{
|
{
|
||||||
return (
|
|
||||||
fallunterscheidung<Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>>
|
export module mod_test
|
||||||
(
|
|
||||||
test,
|
|
||||||
{
|
|
||||||
"akzeptortest": (angaben) => akzeptortest_eingabe(angaben),
|
|
||||||
"transduktortest": (angaben) => transduktortest_eingabe(angaben),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function test_pruefen
|
|
||||||
(
|
|
||||||
test : typ_test,
|
|
||||||
angenommen : boolean,
|
|
||||||
ausgabe : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>
|
|
||||||
)
|
|
||||||
: boolean
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
fallunterscheidung<boolean>
|
|
||||||
(
|
|
||||||
test,
|
|
||||||
{
|
|
||||||
"akzeptortest": (angaben) => akzeptortest_pruefen(angaben, angenommen, ausgabe),
|
|
||||||
"transduktortest": (angaben) => transduktortest_pruefen(angaben, angenommen, ausgabe),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function test_importieren
|
|
||||||
(
|
|
||||||
test_roh : any
|
|
||||||
)
|
|
||||||
: typ_test
|
|
||||||
{
|
|
||||||
switch (test_roh["art"])
|
|
||||||
{
|
{
|
||||||
case "akzeptortest":
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export type typ_test = typ_komplex<Object>;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function eingabe
|
||||||
|
(
|
||||||
|
test : typ_test
|
||||||
|
)
|
||||||
|
: Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>
|
||||||
{
|
{
|
||||||
return {
|
return (
|
||||||
"art": "akzeptortest",
|
fallunterscheidung<Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>>
|
||||||
"angaben": (
|
(
|
||||||
akzeptortest_erstellen
|
test,
|
||||||
(
|
{
|
||||||
test_roh["angaben"]["eingabe"],
|
"akzeptortest": (angaben) => mod_akzeptortest.eingabe(angaben),
|
||||||
test_roh["angaben"]["annehmen"]
|
"transduktortest": (angaben) => mod_transduktortest.eingabe(angaben),
|
||||||
)
|
}
|
||||||
),
|
)
|
||||||
};
|
);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case "transduktortest":
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function pruefen
|
||||||
|
(
|
||||||
|
test : typ_test,
|
||||||
|
angenommen : boolean,
|
||||||
|
ausgabe : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>
|
||||||
|
)
|
||||||
|
: boolean
|
||||||
{
|
{
|
||||||
return {
|
return (
|
||||||
"art": "transduktortest",
|
fallunterscheidung<boolean>
|
||||||
"angaben": (
|
(
|
||||||
transduktortest_erstellen
|
test,
|
||||||
(
|
{
|
||||||
test_roh["angaben"]["eingabe"],
|
"akzeptortest": (angaben) => mod_akzeptortest.pruefen(angaben, angenommen, ausgabe),
|
||||||
test_roh["angaben"]["ausgabe"]
|
"transduktortest": (angaben) => mod_transduktortest.pruefen(angaben, angenommen, ausgabe),
|
||||||
)
|
}
|
||||||
),
|
)
|
||||||
};
|
);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function importieren
|
||||||
|
(
|
||||||
|
test_roh : any
|
||||||
|
)
|
||||||
|
: typ_test
|
||||||
{
|
{
|
||||||
throw (new Error("unbehandelt"));
|
switch (test_roh["art"])
|
||||||
break;
|
{
|
||||||
|
case "akzeptortest":
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
"art": "akzeptortest",
|
||||||
|
"angaben": (
|
||||||
|
mod_akzeptortest.erstellen
|
||||||
|
(
|
||||||
|
test_roh["angaben"]["eingabe"],
|
||||||
|
test_roh["angaben"]["annehmen"]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "transduktortest":
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
"art": "transduktortest",
|
||||||
|
"angaben": (
|
||||||
|
mod_transduktortest.erstellen
|
||||||
|
(
|
||||||
|
test_roh["angaben"]["eingabe"],
|
||||||
|
test_roh["angaben"]["ausgabe"]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
throw (new Error("unbehandelt"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,92 +16,102 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module mod_vtm_aufbau
|
module mod_vtm
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
export module mod_aufbau
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export type typ_transduktoraufgabe =
|
|
||||||
{
|
{
|
||||||
id : string;
|
|
||||||
titel : string;
|
export module mod_transduktoraufgabe
|
||||||
text : string;
|
{
|
||||||
tests : Array<typ_transduktortest>;
|
|
||||||
}
|
/**
|
||||||
;
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export type typ_transduktoraufgabe =
|
||||||
/**
|
{
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
id : string;
|
||||||
*/
|
titel : string;
|
||||||
export function transduktoraufgabe_erstellen
|
text : string;
|
||||||
(
|
tests : Array<mod_transduktortest.typ_transduktortest>;
|
||||||
id : string,
|
}
|
||||||
titel : string,
|
;
|
||||||
text : string,
|
|
||||||
tests : Array<typ_transduktortest>
|
|
||||||
)
|
/**
|
||||||
: typ_transduktoraufgabe
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
{
|
*/
|
||||||
return {
|
export function erstellen
|
||||||
"id": id,
|
(
|
||||||
"titel": titel,
|
id : string,
|
||||||
"text": text,
|
titel : string,
|
||||||
"tests": tests,
|
text : string,
|
||||||
};
|
tests : Array<mod_transduktortest.typ_transduktortest>
|
||||||
}
|
)
|
||||||
|
: typ_transduktoraufgabe
|
||||||
|
{
|
||||||
/**
|
return {
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
"id": id,
|
||||||
*/
|
"titel": titel,
|
||||||
export function transduktoraufgabe_id
|
"text": text,
|
||||||
(
|
"tests": tests,
|
||||||
transduktoraufgabe : typ_transduktoraufgabe
|
};
|
||||||
)
|
}
|
||||||
: string
|
|
||||||
{
|
|
||||||
return transduktoraufgabe.id;
|
/**
|
||||||
}
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function id
|
||||||
/**
|
(
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
transduktoraufgabe : typ_transduktoraufgabe
|
||||||
*/
|
)
|
||||||
export function transduktoraufgabe_titel
|
: string
|
||||||
(
|
{
|
||||||
transduktoraufgabe : typ_transduktoraufgabe
|
return transduktoraufgabe.id;
|
||||||
)
|
}
|
||||||
: string
|
|
||||||
{
|
|
||||||
return transduktoraufgabe.titel;
|
/**
|
||||||
}
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function titel
|
||||||
/**
|
(
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
transduktoraufgabe : typ_transduktoraufgabe
|
||||||
*/
|
)
|
||||||
export function transduktoraufgabe_text
|
: string
|
||||||
(
|
{
|
||||||
transduktoraufgabe : typ_transduktoraufgabe
|
return transduktoraufgabe.titel;
|
||||||
)
|
}
|
||||||
: string
|
|
||||||
{
|
|
||||||
return transduktoraufgabe.text;
|
/**
|
||||||
}
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function text
|
||||||
/**
|
(
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
transduktoraufgabe : typ_transduktoraufgabe
|
||||||
*/
|
)
|
||||||
export function transduktoraufgabe_tests
|
: string
|
||||||
(
|
{
|
||||||
transduktoraufgabe : typ_transduktoraufgabe
|
return transduktoraufgabe.text;
|
||||||
)
|
}
|
||||||
: Array<typ_transduktortest>
|
|
||||||
{
|
|
||||||
return transduktoraufgabe.tests;
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function tests
|
||||||
|
(
|
||||||
|
transduktoraufgabe : typ_transduktoraufgabe
|
||||||
|
)
|
||||||
|
: Array<mod_transduktortest.typ_transduktortest>
|
||||||
|
{
|
||||||
|
return transduktoraufgabe.tests;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,83 +16,92 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module mod_vtm_aufbau
|
module mod_vtm
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
export module mod_aufbau
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export type typ_transduktortest =
|
|
||||||
{
|
{
|
||||||
eingabe : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>;
|
|
||||||
ausgabe : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>;
|
export module mod_transduktortest
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function transduktortest_erstellen
|
|
||||||
(
|
|
||||||
eingabe : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>,
|
|
||||||
ausgabe : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>
|
|
||||||
)
|
|
||||||
: typ_transduktortest
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"eingabe": eingabe,
|
|
||||||
"ausgabe": ausgabe,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function transduktortest_eingabe
|
|
||||||
(
|
|
||||||
transduktortest : typ_transduktortest
|
|
||||||
)
|
|
||||||
: Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>
|
|
||||||
{
|
|
||||||
return transduktortest.eingabe;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function transduktortest_pruefen
|
|
||||||
(
|
|
||||||
transduktortest : typ_transduktortest,
|
|
||||||
angenommen : boolean,
|
|
||||||
ausgabe : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>
|
|
||||||
)
|
|
||||||
: boolean
|
|
||||||
{
|
|
||||||
if (transduktortest.ausgabe.length !== ausgabe.length)
|
|
||||||
{
|
{
|
||||||
return false;
|
|
||||||
}
|
/**
|
||||||
else
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
{
|
*/
|
||||||
let gleich : boolean = true;
|
export type typ_transduktortest =
|
||||||
for (let index : int = 0; index < transduktortest.ausgabe.length; index += 1)
|
|
||||||
{
|
{
|
||||||
if (! mod_vtm.mod_aufbau.mod_symbol.vergleichen(transduktortest.ausgabe[index], ausgabe[index]))
|
eingabe : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>;
|
||||||
|
ausgabe : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function erstellen
|
||||||
|
(
|
||||||
|
eingabe : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>,
|
||||||
|
ausgabe : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>
|
||||||
|
)
|
||||||
|
: typ_transduktortest
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
"eingabe": eingabe,
|
||||||
|
"ausgabe": ausgabe,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function eingabe
|
||||||
|
(
|
||||||
|
transduktortest : typ_transduktortest
|
||||||
|
)
|
||||||
|
: Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>
|
||||||
|
{
|
||||||
|
return transduktortest.eingabe;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function pruefen
|
||||||
|
(
|
||||||
|
transduktortest : typ_transduktortest,
|
||||||
|
angenommen : boolean,
|
||||||
|
ausgabe : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>
|
||||||
|
)
|
||||||
|
: boolean
|
||||||
|
{
|
||||||
|
if (transduktortest.ausgabe.length !== ausgabe.length)
|
||||||
{
|
{
|
||||||
gleich = false;
|
return false;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// nichts tun
|
let gleich : boolean = true;
|
||||||
|
for (let index : int = 0; index < transduktortest.ausgabe.length; index += 1)
|
||||||
|
{
|
||||||
|
if (! mod_vtm.mod_aufbau.mod_symbol.vergleichen(transduktortest.ausgabe[index], ausgabe[index]))
|
||||||
|
{
|
||||||
|
gleich = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// nichts tun
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return gleich;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return gleich;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ module mod_vtm
|
||||||
{
|
{
|
||||||
welt : mod_welt.typ_welt;
|
welt : mod_welt.typ_welt;
|
||||||
figur : schnittstelle_fehlermonade<mod_figur.typ_figur>;
|
figur : schnittstelle_fehlermonade<mod_figur.typ_figur>;
|
||||||
aufgabe : mod_vtm_aufbau.typ_aufgabe;
|
aufgabe : mod_aufgabe.typ_aufgabe;
|
||||||
testindex : schnittstelle_fehlermonade<int>;
|
testindex : schnittstelle_fehlermonade<int>;
|
||||||
modus : mod_modus.typ_modus;
|
modus : mod_modus.typ_modus;
|
||||||
lauscher : {[ereignis : string] : Array<(angaben ?: any)=>void>};
|
lauscher : {[ereignis : string] : Array<(angaben ?: any)=>void>};
|
||||||
|
|
@ -45,7 +45,7 @@ module mod_vtm
|
||||||
*/
|
*/
|
||||||
export function erstellen
|
export function erstellen
|
||||||
(
|
(
|
||||||
aufgabe : mod_vtm_aufbau.typ_aufgabe
|
aufgabe : mod_aufgabe.typ_aufgabe
|
||||||
)
|
)
|
||||||
: typ_partie
|
: typ_partie
|
||||||
{
|
{
|
||||||
|
|
@ -133,7 +133,7 @@ module mod_vtm
|
||||||
/**
|
/**
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
*/
|
*/
|
||||||
export function aufgabe_lesen(partie : typ_partie) : mod_vtm_aufbau.typ_aufgabe
|
export function aufgabe_lesen(partie : typ_partie) : mod_aufgabe.typ_aufgabe
|
||||||
{
|
{
|
||||||
return partie.aufgabe;
|
return partie.aufgabe;
|
||||||
}
|
}
|
||||||
|
|
@ -142,7 +142,7 @@ module mod_vtm
|
||||||
/**
|
/**
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
*/
|
*/
|
||||||
export function aufgabe_setzen(partie : typ_partie, aufgabe : mod_vtm_aufbau.typ_aufgabe) : void
|
export function aufgabe_setzen(partie : typ_partie, aufgabe : mod_aufgabe.typ_aufgabe) : void
|
||||||
{
|
{
|
||||||
partie.aufgabe = aufgabe;
|
partie.aufgabe = aufgabe;
|
||||||
// partie.welt_leeren();
|
// partie.welt_leeren();
|
||||||
|
|
@ -278,8 +278,8 @@ module mod_vtm
|
||||||
{
|
{
|
||||||
if (! partie.figur.ist_schlicht())
|
if (! partie.figur.ist_schlicht())
|
||||||
{
|
{
|
||||||
let test : mod_vtm_aufbau.typ_test = mod_vtm_aufbau.aufgabe_tests(partie.aufgabe)[partie.testindex.lesen()];
|
let test : mod_test.typ_test = mod_aufgabe.tests(partie.aufgabe)[partie.testindex.lesen()];
|
||||||
let band : Array<mod_symbol.typ_symbol> = mod_vtm_helfer.liste_kopieren<mod_symbol.typ_symbol>(mod_vtm_aufbau.test_eingabe(test));
|
let band : Array<mod_symbol.typ_symbol> = mod_vtm_helfer.liste_kopieren<mod_symbol.typ_symbol>(mod_test.eingabe(test));
|
||||||
let stelle : mod_stelle.typ_stelle = mod_welt.erzeuger_finden(partie.welt);
|
let stelle : mod_stelle.typ_stelle = mod_welt.erzeuger_finden(partie.welt);
|
||||||
partie.figur = (
|
partie.figur = (
|
||||||
new klasse_schlicht<mod_figur.typ_figur>
|
new klasse_schlicht<mod_figur.typ_figur>
|
||||||
|
|
@ -310,9 +310,9 @@ module mod_vtm
|
||||||
let ausgabe : Array<mod_symbol.typ_symbol> = mod_figur.band_lesen(figur);
|
let ausgabe : Array<mod_symbol.typ_symbol> = mod_figur.band_lesen(figur);
|
||||||
partie.figur = (new klasse_nichts<mod_figur.typ_figur>());
|
partie.figur = (new klasse_nichts<mod_figur.typ_figur>());
|
||||||
let testindex : int = partie.testindex.lesen();
|
let testindex : int = partie.testindex.lesen();
|
||||||
let tests : Array<mod_vtm_aufbau.typ_test> = mod_vtm_aufbau.aufgabe_tests(partie.aufgabe);
|
let tests : Array<mod_test.typ_test> = mod_aufgabe.tests(partie.aufgabe);
|
||||||
let test : mod_vtm_aufbau.typ_test = tests[testindex];
|
let test : mod_test.typ_test = tests[testindex];
|
||||||
if (! mod_vtm_aufbau.test_pruefen(test, angenommen, ausgabe))
|
if (! mod_test.pruefen(test, angenommen, ausgabe))
|
||||||
{
|
{
|
||||||
partie.modus = mod_modus.fehlerhaft;
|
partie.modus = mod_modus.fehlerhaft;
|
||||||
benachrichtigen(partie, "aenderung_modus", {});
|
benachrichtigen(partie, "aenderung_modus", {});
|
||||||
|
|
|
||||||
|
|
@ -16,196 +16,207 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
module mod_vtm
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function aufgaben_eintragen(behandler : (aufgabe : mod_vtm_aufbau.typ_aufgabe)=>void) : void
|
|
||||||
{
|
{
|
||||||
let aufgaben_roh_ : schnittstelle_fehlermonade<Array<any>> = mod_vtm_daten.lesen("aufgaben");
|
|
||||||
if (aufgaben_roh_.ist_schlicht())
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function aufgaben_eintragen(behandler : (aufgabe : mod_aufbau.mod_aufgabe.typ_aufgabe)=>void) : void
|
||||||
{
|
{
|
||||||
let aufgaben_roh : Array<any> = aufgaben_roh_.lesen();
|
let aufgaben_roh_ : schnittstelle_fehlermonade<Array<any>> = mod_vtm_daten.lesen("aufgaben");
|
||||||
let dom_auswahl : Element = document.querySelector("#aufgabe_auswahl");
|
if (aufgaben_roh_.ist_schlicht())
|
||||||
aufgaben_roh.forEach
|
{
|
||||||
(
|
let aufgaben_roh : Array<any> = aufgaben_roh_.lesen();
|
||||||
(aufgabe_roh, index) =>
|
let dom_auswahl : Element = document.querySelector("#aufgabe_auswahl");
|
||||||
{
|
aufgaben_roh.forEach
|
||||||
// Aufgabe registrieren
|
(
|
||||||
{
|
(aufgabe_roh, index) =>
|
||||||
let aufgabe : mod_vtm_aufbau.typ_aufgabe = mod_vtm_aufbau.aufgabe_importieren(aufgabe_roh);
|
{
|
||||||
mod_vtm_aufbau.aufgabe_registrieren(aufgabe);
|
// Aufgabe registrieren
|
||||||
}
|
|
||||||
// Option eintragen
|
|
||||||
{
|
|
||||||
let praefix : string = (
|
|
||||||
{
|
{
|
||||||
"akzeptor": mod_vtm_helfer.uebersetzung_holen("aufbau.aufgaben.arten.akzeptor.kuerzel"),
|
let aufgabe : mod_aufbau.mod_aufgabe.typ_aufgabe = mod_aufbau.mod_aufgabe.importieren(aufgabe_roh);
|
||||||
"transduktor": mod_vtm_helfer.uebersetzung_holen("aufbau.aufgaben.arten.transduktor.kuerzel"),
|
mod_aufbau.mod_aufgabe.registrieren(aufgabe);
|
||||||
}[aufgabe_roh["art"]]
|
}
|
||||||
);
|
// Option eintragen
|
||||||
let titel : string = ("[" + praefix + "]" + " " + aufgabe_roh["parameter"]["titel"]);
|
{
|
||||||
let value : string = index.toFixed(0);
|
let praefix : string = (
|
||||||
let dom_option : Element = document.createElement("option");
|
{
|
||||||
dom_option.setAttribute("value", value);
|
"akzeptor": mod_vtm_helfer.uebersetzung_holen("aufbau.aufgaben.arten.akzeptor.kuerzel"),
|
||||||
dom_option.textContent = titel;
|
"transduktor": mod_vtm_helfer.uebersetzung_holen("aufbau.aufgaben.arten.transduktor.kuerzel"),
|
||||||
dom_auswahl.appendChild(dom_option);
|
}[aufgabe_roh["art"]]
|
||||||
}
|
);
|
||||||
}
|
let titel : string = ("[" + praefix + "]" + " " + aufgabe_roh["parameter"]["titel"]);
|
||||||
)
|
let value : string = index.toFixed(0);
|
||||||
;
|
let dom_option : Element = document.createElement("option");
|
||||||
dom_auswahl.addEventListener
|
dom_option.setAttribute("value", value);
|
||||||
(
|
dom_option.textContent = titel;
|
||||||
"change",
|
dom_auswahl.appendChild(dom_option);
|
||||||
event =>
|
}
|
||||||
{
|
}
|
||||||
let value : string = dom_auswahl["value"];
|
)
|
||||||
let index : int = parseInt(value);
|
;
|
||||||
let aufgabe : mod_vtm_aufbau.typ_aufgabe = mod_vtm_aufbau.aufgabe_holen(index);
|
dom_auswahl.addEventListener
|
||||||
behandler(aufgabe);
|
(
|
||||||
}
|
"change",
|
||||||
)
|
event =>
|
||||||
;
|
{
|
||||||
|
let value : string = dom_auswahl["value"];
|
||||||
|
let index : int = parseInt(value);
|
||||||
|
let aufgabe : mod_aufbau.mod_aufgabe.typ_aufgabe = mod_aufbau.mod_aufgabe.holen(index);
|
||||||
|
behandler(aufgabe);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
console.warn("Daten nicht auffindbar");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
console.warn("Daten nicht auffindbar");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
*/
|
*/
|
||||||
function haupt() : void
|
function haupt() : void
|
||||||
{
|
|
||||||
// Übersetzungen
|
|
||||||
{
|
|
||||||
let sprachen : Array<string> = navigator.languages.map(sprache => sprache);
|
|
||||||
let sprache_nativ : string = "de";
|
|
||||||
if (! sprachen[""+"includes"](sprache_nativ))
|
|
||||||
sprachen.push(sprache_nativ);
|
|
||||||
mod_vtm_helfer.uebersetzung_einrichten(sprachen);
|
|
||||||
mod_vtm_helfer.uebersetzung_anwenden(document);
|
|
||||||
}
|
|
||||||
// Hilfe
|
|
||||||
{
|
|
||||||
// Einleitung
|
|
||||||
{
|
{
|
||||||
document.querySelector("#hilfe_einleitung").innerHTML = (
|
// Übersetzungen
|
||||||
mod_vtm_helfer.uebersetzung_holen
|
|
||||||
(
|
|
||||||
"hilfe.einleitung",
|
|
||||||
{
|
|
||||||
"manufacturia": "<a href=\"http://www.kongregate.com/games/PleasingFungus/manufactoria\">Manufacturia</a>",
|
|
||||||
"crazy_machines": "<a href=\"http://www.crazy-machines.com/\">Crazy Machines</a>",
|
|
||||||
"world_of_goo": "<a href=\"http://worldofgoo.com/\">World of Goo</a>",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// Aktoren
|
|
||||||
{
|
|
||||||
// Arten
|
|
||||||
{
|
{
|
||||||
let von_x : float = -0.5;
|
let sprachen : Array<string> = navigator.languages.map(sprache => sprache);
|
||||||
let von_y : float = -0.5;
|
let sprache_nativ : string = "de";
|
||||||
let bis_x : float = +0.5;
|
if (! sprachen[""+"includes"](sprache_nativ))
|
||||||
let bis_y : float = +0.5;
|
sprachen.push(sprache_nativ);
|
||||||
let breite : float = 80;
|
mod_vtm_helfer.uebersetzung_einrichten(sprachen);
|
||||||
let hoehe : float = 80;
|
mod_vtm_helfer.uebersetzung_anwenden(document);
|
||||||
[
|
}
|
||||||
|
// Hilfe
|
||||||
|
{
|
||||||
|
// Einleitung
|
||||||
|
{
|
||||||
|
document.querySelector("#hilfe_einleitung").innerHTML = (
|
||||||
|
mod_vtm_helfer.uebersetzung_holen
|
||||||
|
(
|
||||||
|
"hilfe.einleitung",
|
||||||
|
{
|
||||||
|
"manufacturia": "<a href=\"http://www.kongregate.com/games/PleasingFungus/manufactoria\">Manufacturia</a>",
|
||||||
|
"crazy_machines": "<a href=\"http://www.crazy-machines.com/\">Crazy Machines</a>",
|
||||||
|
"world_of_goo": "<a href=\"http://worldofgoo.com/\">World of Goo</a>",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// Aktoren
|
||||||
|
{
|
||||||
|
// Arten
|
||||||
{
|
{
|
||||||
"aufbau": mod_vtm.mod_aufbau.mod_aktor.beispiel("erzeuger"),
|
let von_x : float = -0.5;
|
||||||
"bereich": document.querySelector("#hilfe_aktoren_aktor_erzeuger"),
|
let von_y : float = -0.5;
|
||||||
},
|
let bis_x : float = +0.5;
|
||||||
{
|
let bis_y : float = +0.5;
|
||||||
"aufbau": mod_vtm.mod_aufbau.mod_aktor.beispiel("annehmer"),
|
let breite : float = 80;
|
||||||
"bereich": document.querySelector("#hilfe_aktoren_aktor_annehmer"),
|
let hoehe : float = 80;
|
||||||
},
|
[
|
||||||
{
|
|
||||||
"aufbau": mod_vtm.mod_aufbau.mod_aktor.beispiel("verwerfer"),
|
|
||||||
"bereich": document.querySelector("#hilfe_aktoren_aktor_verwerfer"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"aufbau": mod_vtm.mod_aufbau.mod_aktor.beispiel("befoerderer"),
|
|
||||||
"bereich": document.querySelector("#hilfe_aktoren_aktor_befoerderer"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"aufbau": mod_vtm.mod_aufbau.mod_aktor.beispiel("schreiber"),
|
|
||||||
"bereich": document.querySelector("#hilfe_aktoren_aktor_schreiber"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"aufbau": mod_vtm.mod_aufbau.mod_aktor.beispiel("leser"),
|
|
||||||
"bereich": document.querySelector("#hilfe_aktoren_aktor_leser"),
|
|
||||||
},
|
|
||||||
]
|
|
||||||
.forEach
|
|
||||||
(
|
|
||||||
eintrag =>
|
|
||||||
{
|
{
|
||||||
let manifestor = (
|
"aufbau": mod_aufbau.mod_aktor.beispiel("erzeuger"),
|
||||||
mod_vtm_manifestation.svg_aktor_erstellen_manifestation
|
"bereich": document.querySelector("#hilfe_aktoren_aktor_erzeuger"),
|
||||||
(
|
},
|
||||||
eintrag.aufbau,
|
{
|
||||||
mod_vtm.mod_aufbau.mod_stelle.null_()
|
"aufbau": mod_aufbau.mod_aktor.beispiel("annehmer"),
|
||||||
)
|
"bereich": document.querySelector("#hilfe_aktoren_aktor_annehmer"),
|
||||||
);
|
},
|
||||||
let xmlknoten : mod_vtm_helfer.typ_xmlknoten = (
|
{
|
||||||
mod_vtm_manifestation.svg_wurzel
|
"aufbau": mod_aufbau.mod_aktor.beispiel("verwerfer"),
|
||||||
(
|
"bereich": document.querySelector("#hilfe_aktoren_aktor_verwerfer"),
|
||||||
von_x, von_y,
|
},
|
||||||
bis_x, bis_y,
|
{
|
||||||
breite, hoehe,
|
"aufbau": mod_aufbau.mod_aktor.beispiel("befoerderer"),
|
||||||
[mod_vtm_manifestation.manifestation_darstellen(manifestor)]
|
"bereich": document.querySelector("#hilfe_aktoren_aktor_befoerderer"),
|
||||||
)
|
},
|
||||||
);
|
{
|
||||||
eintrag.bereich.querySelector(".hilfe_aktoren_aktor_bild").innerHTML = mod_vtm_helfer.xmlknoten_darstellen(xmlknoten);
|
"aufbau": mod_aufbau.mod_aktor.beispiel("schreiber"),
|
||||||
}
|
"bereich": document.querySelector("#hilfe_aktoren_aktor_schreiber"),
|
||||||
)
|
},
|
||||||
;
|
{
|
||||||
|
"aufbau": mod_aufbau.mod_aktor.beispiel("leser"),
|
||||||
|
"bereich": document.querySelector("#hilfe_aktoren_aktor_leser"),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
.forEach
|
||||||
|
(
|
||||||
|
eintrag =>
|
||||||
|
{
|
||||||
|
let manifestor = (
|
||||||
|
mod_manifestation.mod_svg.mod_aktor.erstellen_manifestation
|
||||||
|
(
|
||||||
|
eintrag.aufbau,
|
||||||
|
mod_aufbau.mod_stelle.null_()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
let xmlknoten : mod_vtm_helfer.typ_xmlknoten = (
|
||||||
|
mod_manifestation.mod_svg.wurzel
|
||||||
|
(
|
||||||
|
von_x, von_y,
|
||||||
|
bis_x, bis_y,
|
||||||
|
breite, hoehe,
|
||||||
|
[mod_manifestation.darstellen(manifestor)]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
eintrag.bereich.querySelector(".hilfe_aktoren_aktor_bild").innerHTML = mod_vtm_helfer.xmlknoten_darstellen(xmlknoten);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Spiel
|
||||||
|
{
|
||||||
|
let partie : mod_aufbau.mod_partie.typ_partie;
|
||||||
|
// Aufgaben
|
||||||
|
{
|
||||||
|
aufgaben_eintragen
|
||||||
|
(
|
||||||
|
function (aufgabe : mod_aufbau.mod_aufgabe.typ_aufgabe) : void {mod_aufbau.mod_partie.aufgabe_setzen(partie, aufgabe);}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
partie = mod_aufbau.mod_partie.erstellen(mod_aufbau.mod_aufgabe.holen(0));
|
||||||
|
}
|
||||||
|
// Partie
|
||||||
|
{
|
||||||
|
mod_manifestation.einrichten
|
||||||
|
(
|
||||||
|
mod_manifestation.mod_web.mod_partie.erstellen_erweitert
|
||||||
|
(
|
||||||
|
partie,
|
||||||
|
document.querySelector("#bereich_mitte")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
;
|
||||||
|
mod_manifestation.einrichten
|
||||||
|
(
|
||||||
|
mod_manifestation.mod_speicher.mod_partie.erstellen_erweitert
|
||||||
|
(
|
||||||
|
partie
|
||||||
|
)
|
||||||
|
)
|
||||||
|
;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// Spiel
|
|
||||||
{
|
/**
|
||||||
let aufbau : mod_vtm.mod_aufbau.mod_partie.typ_partie;
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
aufgaben_eintragen
|
*/
|
||||||
(
|
export function eingang_web() : void
|
||||||
function (aufgabe : mod_vtm_aufbau.typ_aufgabe) : void {mod_vtm.mod_aufbau.mod_partie.aufgabe_setzen(aufbau, aufgabe);}
|
{
|
||||||
)
|
document.addEventListener
|
||||||
;
|
(
|
||||||
aufbau = mod_vtm.mod_aufbau.mod_partie.erstellen(mod_vtm_aufbau.aufgabe_holen(0));
|
"DOMContentLoaded",
|
||||||
mod_vtm_manifestation.manifestation_einrichten
|
event => {haupt();}
|
||||||
(
|
)
|
||||||
mod_vtm_manifestation.web_partie_erstellen_erweitert
|
;
|
||||||
(
|
}
|
||||||
aufbau,
|
|
||||||
document.querySelector("#bereich_mitte")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
;
|
|
||||||
mod_vtm_manifestation.manifestation_einrichten
|
|
||||||
(
|
|
||||||
mod_vtm_manifestation.speicher_partie_erstellen_erweitert
|
|
||||||
(
|
|
||||||
aufbau
|
|
||||||
)
|
|
||||||
)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function eingang_web() : void
|
|
||||||
{
|
|
||||||
document.addEventListener
|
|
||||||
(
|
|
||||||
"DOMContentLoaded",
|
|
||||||
event => {haupt();}
|
|
||||||
)
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,39 +16,49 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module mod_vtm_helfer
|
module mod_vtm
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
export module mod_helfer
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export type typ_vektor = {x : float; y : float;};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function vektor_polar(winkel : float, radius : float = 1) : typ_vektor
|
|
||||||
{
|
{
|
||||||
return {"x": (radius * Math.cos(winkel)), "y": (radius * Math.sin(winkel))};
|
|
||||||
}
|
export module mod_vektor
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
*/
|
*/
|
||||||
export function vektor_skalieren(vektor : typ_vektor, faktor : float) : typ_vektor
|
export type typ_vektor = {x : float; y : float;};
|
||||||
{
|
|
||||||
return {"x": (vektor.x * faktor), "y": (vektor.y * faktor)};
|
|
||||||
}
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
/**
|
export function polar(winkel : float, radius : float = 1) : typ_vektor
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
{
|
||||||
*/
|
return {"x": (radius * Math.cos(winkel)), "y": (radius * Math.sin(winkel))};
|
||||||
export function vektor_addieren(vektor1 : typ_vektor, vektor2 : typ_vektor) : typ_vektor
|
}
|
||||||
{
|
|
||||||
return {"x": (vektor1.x + vektor2.x), "y": (vektor1.y + vektor2.y)};
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function skalieren(vektor : typ_vektor, faktor : float) : typ_vektor
|
||||||
|
{
|
||||||
|
return {"x": (vektor.x * faktor), "y": (vektor.y * faktor)};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function addieren(vektor1 : typ_vektor, vektor2 : typ_vektor) : typ_vektor
|
||||||
|
{
|
||||||
|
return {"x": (vektor1.x + vektor2.x), "y": (vektor1.y + vektor2.y)};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,57 +16,62 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module mod_vtm_manifestation
|
module mod_vtm
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
export module mod_manifestation
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export type typ_manifestation<typ_aufbau> = typ_komplex<any>;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export type schnittstelle_manifestation<typ_aufbau, typ_ausgabe> =
|
|
||||||
{
|
{
|
||||||
darstellen : (manifestation : typ_manifestation<typ_aufbau>)=>typ_ausgabe;
|
|
||||||
binden : (manifestation : typ_manifestation<typ_aufbau>)=>void;
|
/**
|
||||||
}
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
;
|
*/
|
||||||
|
export type typ_manifestation<typ_aufbau> = typ_komplex<any>;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
/**
|
||||||
*/
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
export var implementierung_manifestation : {[art : string] : schnittstelle_manifestation<any, any>} = {};
|
*/
|
||||||
|
export type schnittstelle_manifestation<typ_aufbau, typ_ausgabe> =
|
||||||
|
{
|
||||||
/**
|
darstellen : (manifestation : typ_manifestation<typ_aufbau>)=>typ_ausgabe;
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
binden : (manifestation : typ_manifestation<typ_aufbau>)=>void;
|
||||||
*/
|
}
|
||||||
export function manifestation_darstellen<typ_aufbau, typ_ausgabe>(manifestation : typ_manifestation<typ_aufbau>) : typ_ausgabe
|
;
|
||||||
{
|
|
||||||
return implementierung_manifestation[manifestation.art].darstellen(manifestation);
|
|
||||||
}
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
/**
|
export var implementierung_manifestation : {[art : string] : schnittstelle_manifestation<any, any>} = {};
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function manifestation_binden<typ_aufbau, typ_ausgabe>(manifestation : typ_manifestation<typ_aufbau>) : void
|
/**
|
||||||
{
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
return implementierung_manifestation[manifestation.art].binden(manifestation);
|
*/
|
||||||
}
|
export function darstellen<typ_aufbau, typ_ausgabe>(manifestation : typ_manifestation<typ_aufbau>) : typ_ausgabe
|
||||||
|
{
|
||||||
|
return implementierung_manifestation[manifestation.art].darstellen(manifestation);
|
||||||
/**
|
}
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function manifestation_einrichten<typ_aufbau, typ_ausgabe>(manifestation : typ_manifestation<typ_aufbau>) : void
|
/**
|
||||||
{
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
manifestation_darstellen<typ_aufbau, typ_ausgabe>(manifestation);
|
*/
|
||||||
manifestation_binden<typ_aufbau, typ_ausgabe>(manifestation);
|
export function binden<typ_aufbau, typ_ausgabe>(manifestation : typ_manifestation<typ_aufbau>) : void
|
||||||
|
{
|
||||||
|
return implementierung_manifestation[manifestation.art].binden(manifestation);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function einrichten<typ_aufbau, typ_ausgabe>(manifestation : typ_manifestation<typ_aufbau>) : void
|
||||||
|
{
|
||||||
|
darstellen<typ_aufbau, typ_ausgabe>(manifestation);
|
||||||
|
binden<typ_aufbau, typ_ausgabe>(manifestation);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,34 +16,44 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module mod_vtm_manifestation
|
module mod_vtm
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
export module mod_manifestation
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export type typ_position = mod_vtm_helfer.typ_vektor;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
var position_basis1 : typ_position = mod_vtm_helfer.vektor_polar((0/6) * (2*Math.PI));
|
|
||||||
var position_basis2 : typ_position = mod_vtm_helfer.vektor_polar((2/6) * (2*Math.PI));
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function position_von_stelle(stelle : mod_vtm_aufbau.typ_stelle) : typ_position
|
|
||||||
{
|
{
|
||||||
return (
|
|
||||||
mod_vtm_helfer.vektor_addieren
|
export module mod_position
|
||||||
(
|
{
|
||||||
mod_vtm_helfer.vektor_skalieren(position_basis1, stelle.u),
|
|
||||||
mod_vtm_helfer.vektor_skalieren(position_basis2, stelle.v)
|
/**
|
||||||
)
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
);
|
*/
|
||||||
|
export type typ_position = mod_vtm_helfer.typ_vektor;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
var basis1 : typ_position = mod_vtm_helfer.vektor_polar((0/6) * (2*Math.PI));
|
||||||
|
var basis2 : typ_position = mod_vtm_helfer.vektor_polar((2/6) * (2*Math.PI));
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function von_stelle(stelle : mod_vtm.mod_aufbau.mod_stelle.typ_stelle) : typ_position
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
mod_vtm_helfer.vektor_addieren
|
||||||
|
(
|
||||||
|
mod_vtm_helfer.vektor_skalieren(basis1, stelle.u),
|
||||||
|
mod_vtm_helfer.vektor_skalieren(basis2, stelle.v)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,131 +16,153 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module mod_vtm_manifestation
|
module mod_vtm
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
export module mod_manifestation
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export type typ_speicher_partie =
|
|
||||||
{
|
{
|
||||||
aufbau : mod_vtm_aufbau.typ_partie;
|
|
||||||
}
|
export module mod_speicher
|
||||||
;
|
{
|
||||||
|
|
||||||
|
export module mod_partie
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function speicher_partie_erstellen
|
|
||||||
(
|
|
||||||
aufbau : mod_vtm_aufbau.typ_partie
|
|
||||||
)
|
|
||||||
: typ_speicher_partie
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"aufbau": aufbau
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function speicher_partie_erstellen_erweitert
|
|
||||||
(
|
|
||||||
aufbau : mod_vtm_aufbau.typ_partie
|
|
||||||
)
|
|
||||||
: typ_manifestation<mod_vtm_aufbau.typ_partie>
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"art": "speicher_partie",
|
|
||||||
"angaben": speicher_partie_erstellen(aufbau)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function speicher_partie_darstellen(speicher_partie : typ_speicher_partie) : void
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function speicher_partie_binden(speicher_partie : typ_speicher_partie) : void
|
|
||||||
{
|
|
||||||
mod_vtm_aufbau.partie_lauschen
|
|
||||||
(
|
|
||||||
this.aufbau,
|
|
||||||
"aenderung_aufgabe",
|
|
||||||
(angaben) =>
|
|
||||||
{
|
{
|
||||||
// console.info("aenderung_aufgabe", angaben);
|
|
||||||
let id : string = mod_vtm_aufbau.aufgabe_id(mod_vtm_aufbau.partie_aufgabe_lesen(this.aufbau))
|
/**
|
||||||
let key : string = ("vtm_" + id);
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
if (key in localStorage)
|
*/
|
||||||
|
export type typ_partie =
|
||||||
{
|
{
|
||||||
let item : string = localStorage.getItem(key);
|
aufbau : mod_vtm.mod_aufbau.mod_partie.typ_partie;
|
||||||
let welt : mod_vtm_aufbau.typ_welt = mod_vtm_aufbau.welt_importieren(JSON.parse(item));
|
|
||||||
mod_vtm_aufbau.partie_welt_setzen(this.aufbau, welt, false);
|
|
||||||
}
|
}
|
||||||
else
|
;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function erstellen
|
||||||
|
(
|
||||||
|
aufbau : mod_vtm.mod_aufbau.mod_partie.typ_partie
|
||||||
|
)
|
||||||
|
: typ_partie
|
||||||
{
|
{
|
||||||
mod_vtm_aufbau.partie_welt_leeren(this.aufbau);
|
return {
|
||||||
// nichts tun
|
"aufbau": aufbau
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function erstellen_erweitert
|
||||||
|
(
|
||||||
|
aufbau : mod_vtm.mod_aufbau.mod_partie.typ_partie
|
||||||
|
)
|
||||||
|
: typ_manifestation<mod_vtm.mod_aufbau.mod_partie.typ_partie>
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
"art": "partie",
|
||||||
|
"angaben": erstellen(aufbau)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function darstellen(partie : typ_partie) : void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function binden(partie : typ_partie) : void
|
||||||
|
{
|
||||||
|
mod_vtm.mod_aufbau.mod_partie.lauschen
|
||||||
|
(
|
||||||
|
partie.aufbau,
|
||||||
|
"aenderung_aufgabe",
|
||||||
|
(angaben) =>
|
||||||
|
{
|
||||||
|
// console.info("aenderung_aufgabe", angaben);
|
||||||
|
let aufgabe : mod_vtm.mod_aufbau.mod_aufgabe.typ_aufgabe = mod_vtm.mod_aufbau.mod_partie.aufgabe_lesen(partie.aufbau);
|
||||||
|
let id : string = mod_vtm.mod_aufbau.mod_aufgabe.id(aufgabe);
|
||||||
|
let key : string = ("vtm_" + id);
|
||||||
|
//
|
||||||
|
if (key in localStorage)
|
||||||
|
{
|
||||||
|
let item : string = localStorage.getItem(key);
|
||||||
|
let welt_ : any = JSON.parse(item);
|
||||||
|
let welt : mod_vtm.mod_aufbau.mod_welt.typ_welt = mod_vtm.mod_aufbau.mod_welt.importieren(welt_);
|
||||||
|
mod_vtm.mod_aufbau.mod_partie.welt_setzen(partie.aufbau, welt, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mod_vtm.mod_aufbau.mod_partie.welt_leeren(partie.aufbau);
|
||||||
|
// nichts tun
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
mod_vtm.mod_aufbau.mod_partie.lauschen
|
||||||
|
(
|
||||||
|
partie.aufbau,
|
||||||
|
"aenderung_welt",
|
||||||
|
(angaben) =>
|
||||||
|
{
|
||||||
|
let aufgabe : mod_vtm.mod_aufbau.mod_aufgabe.typ_aufgabe = mod_vtm.mod_aufbau.mod_partie.aufgabe_lesen(partie.aufbau);
|
||||||
|
let id : string = mod_vtm.mod_aufbau.mod_aufgabe.id(aufgabe);
|
||||||
|
let key : string = ("vtm_" + id);
|
||||||
|
//
|
||||||
|
let welt : mod_vtm.mod_aufbau.mod_welt.typ_welt = mod_vtm.mod_aufbau.mod_partie.welt_lesen(partie.aufbau);
|
||||||
|
let welt_ : any = mod_vtm.mod_aufbau.mod_welt.exportieren(welt);
|
||||||
|
let item : string = JSON.stringify(welt_);
|
||||||
|
localStorage.setItem(key, item);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
mod_vtm.mod_aufbau.mod_partie.lauschen
|
||||||
|
(
|
||||||
|
partie.aufbau,
|
||||||
|
"aenderung_figur",
|
||||||
|
(angaben) =>
|
||||||
|
{
|
||||||
|
// console.info("aenderung_figur", angaben);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
mod_vtm.mod_aufbau.mod_partie.lauschen
|
||||||
|
(
|
||||||
|
partie.aufbau,
|
||||||
|
"aenderung_modus",
|
||||||
|
(angaben) =>
|
||||||
|
{
|
||||||
|
// console.info("aenderung_modus", angaben);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
implementierung_manifestation["partie"] =
|
||||||
|
{
|
||||||
|
"darstellen": (manifestation) => darstellen(manifestation.angaben),
|
||||||
|
"binden": (manifestation) => binden(manifestation.angaben),
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
|
||||||
;
|
}
|
||||||
mod_vtm_aufbau.partie_lauschen
|
|
||||||
(
|
|
||||||
this.aufbau,
|
|
||||||
"aenderung_welt",
|
|
||||||
(angaben) =>
|
|
||||||
{
|
|
||||||
let id : string = mod_vtm_aufbau.aufgabe_id(mod_vtm_aufbau.partie_aufgabe_lesen(this.aufbau))
|
|
||||||
let key : string = ("vtm_" + id);
|
|
||||||
let item : string = JSON.stringify(mod_vtm_aufbau.welt_exportieren(mod_vtm_aufbau.partie_welt_lesen(this.aufbau)));
|
|
||||||
localStorage.setItem(key, item);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
;
|
|
||||||
mod_vtm_aufbau.partie_lauschen
|
|
||||||
(
|
|
||||||
this.aufbau,
|
|
||||||
"aenderung_figur",
|
|
||||||
(angaben) =>
|
|
||||||
{
|
|
||||||
// console.info("aenderung_figur", angaben);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
;
|
|
||||||
mod_vtm_aufbau.partie_lauschen
|
|
||||||
(
|
|
||||||
this.aufbau,
|
|
||||||
"aenderung_modus",
|
|
||||||
(angaben) =>
|
|
||||||
{
|
|
||||||
// console.info("aenderung_modus", angaben);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
implementierung_manifestation["speicher_partie"] =
|
|
||||||
{
|
|
||||||
"darstellen": (manifestation) => speicher_partie_darstellen(manifestation.angaben),
|
|
||||||
"binden": (manifestation) => speicher_partie_binden(manifestation.angaben),
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,302 +16,324 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module mod_vtm_manifestation
|
module mod_vtm
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
export module mod_manifestation
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export type typ_svg_aktor =
|
|
||||||
{
|
{
|
||||||
aufbau : mod_vtm_aufbau.typ_aktor;
|
|
||||||
stelle : mod_vtm_aufbau.typ_stelle;
|
export module mod_svg
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function svg_aktor_erstellen
|
|
||||||
(
|
|
||||||
aufbau : mod_vtm_aufbau.typ_aktor,
|
|
||||||
stelle : mod_vtm_aufbau.typ_stelle
|
|
||||||
)
|
|
||||||
: typ_svg_aktor
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"aufbau": aufbau,
|
|
||||||
"stelle": stelle
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function svg_aktor_erstellen_manifestation
|
|
||||||
(
|
|
||||||
aufbau : mod_vtm_aufbau.typ_aktor,
|
|
||||||
stelle : mod_vtm_aufbau.typ_stelle
|
|
||||||
)
|
|
||||||
: typ_manifestation<mod_vtm_aufbau.typ_aktor>
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"art": "svg_aktor",
|
|
||||||
"angaben": svg_aktor_erstellen(aufbau, stelle),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function svg_aktor_darstellen(svg_aktor : typ_svg_aktor) : mod_vtm_helfer.typ_xmlknoten
|
|
||||||
{
|
|
||||||
let aktor : mod_vtm_aufbau.typ_aktor = svg_aktor.aufbau;
|
|
||||||
let knoten_rahmen = function () : mod_vtm_helfer.typ_xmlknoten
|
|
||||||
{
|
{
|
||||||
return (
|
|
||||||
svg_pfad
|
export module mod_aktor
|
||||||
(
|
|
||||||
mod_vtm_helfer.sequenz(6).map(i => mod_vtm_helfer.vektor_polar(((i+0.5)/6) * (2*Math.PI), 0.5)),
|
|
||||||
true,
|
|
||||||
{
|
|
||||||
"class": "rahmen"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
;
|
|
||||||
let kinder_feld : Array<mod_vtm_helfer.typ_xmlknoten> = [];
|
|
||||||
fallunterscheidung<void>
|
|
||||||
(
|
|
||||||
aktor,
|
|
||||||
{
|
|
||||||
"erzeuger": (angaben) =>
|
|
||||||
{
|
|
||||||
kinder_feld.push(knoten_rahmen());
|
|
||||||
let richtung : mod_vtm_aufbau.typ_richtung = mod_vtm_aufbau.erzeuger_richtung_lesen(angaben);
|
|
||||||
let knoten_pfeil : mod_vtm_helfer.typ_xmlknoten = (
|
|
||||||
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
|
||||||
(
|
|
||||||
"path",
|
|
||||||
{
|
|
||||||
"d": svg_form_pfeil,
|
|
||||||
"class": (
|
|
||||||
[
|
|
||||||
"pfeil",
|
|
||||||
"erzeuger",
|
|
||||||
].join(" ")
|
|
||||||
),
|
|
||||||
"transform": (
|
|
||||||
[
|
|
||||||
"rotate(" + ((richtung/6) * 360).toFixed(svg_float_praezission) + ")",
|
|
||||||
"translate(-0.2, 0)",
|
|
||||||
"scale(0.12)",
|
|
||||||
].join(" ")
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
kinder_feld.push(knoten_pfeil);
|
|
||||||
}
|
|
||||||
,
|
|
||||||
"befoerderer": (angaben) =>
|
|
||||||
{
|
|
||||||
kinder_feld.push(knoten_rahmen());
|
|
||||||
let richtung : mod_vtm_aufbau.typ_richtung = mod_vtm_aufbau.befoerderer_richtung_lesen(angaben);
|
|
||||||
let knoten_pfeil : mod_vtm_helfer.typ_xmlknoten = (
|
|
||||||
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
|
||||||
(
|
|
||||||
"path",
|
|
||||||
{
|
|
||||||
"d": svg_form_pfeil,
|
|
||||||
"class": (
|
|
||||||
[
|
|
||||||
"pfeil",
|
|
||||||
"neutral",
|
|
||||||
].join(" ")
|
|
||||||
),
|
|
||||||
"transform": (
|
|
||||||
[
|
|
||||||
"rotate(" + ((richtung/6) * 360).toFixed(svg_float_praezission) + ")",
|
|
||||||
"translate(-0.2, 0)",
|
|
||||||
"scale(0.12)",
|
|
||||||
].join(" ")
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
kinder_feld.push(knoten_pfeil);
|
|
||||||
}
|
|
||||||
,
|
|
||||||
"schreiber": (angaben) =>
|
|
||||||
{
|
|
||||||
kinder_feld.push(knoten_rahmen());
|
|
||||||
let richtung : mod_vtm_aufbau.typ_richtung = mod_vtm_aufbau.schreiber_richtung_lesen(angaben);
|
|
||||||
let symbol : mod_vtm_aufbau.typ_symbol = mod_vtm_aufbau.schreiber_symbol_lesen(angaben);
|
|
||||||
let knoten_pfeil : mod_vtm_helfer.typ_xmlknoten = (
|
|
||||||
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
|
||||||
(
|
|
||||||
"path",
|
|
||||||
{
|
|
||||||
"d": svg_form_pfeil,
|
|
||||||
"class": (
|
|
||||||
[
|
|
||||||
"pfeil",
|
|
||||||
"symbol_" + symbol.toFixed(0),
|
|
||||||
].join(" ")
|
|
||||||
),
|
|
||||||
"transform": (
|
|
||||||
[
|
|
||||||
"rotate(" + ((richtung/6) * 360).toFixed(svg_float_praezission) + ")",
|
|
||||||
"translate(-0.2, 0)",
|
|
||||||
"scale(0.12)",
|
|
||||||
].join(" ")
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
kinder_feld.push(knoten_pfeil);
|
|
||||||
}
|
|
||||||
,
|
|
||||||
"leser": (angaben) =>
|
|
||||||
{
|
|
||||||
kinder_feld.push(knoten_rahmen());
|
|
||||||
let richtung : mod_vtm_aufbau.typ_richtung = mod_vtm_aufbau.leser_richtung_lesen(angaben);
|
|
||||||
let symbol_links : mod_vtm_aufbau.typ_symbol = mod_vtm_aufbau.leser_symbol_links_lesen(angaben);
|
|
||||||
let symbol_rechts : mod_vtm_aufbau.typ_symbol = mod_vtm_aufbau.leser_symbol_rechts_lesen(angaben);
|
|
||||||
let ausgaenge : Array<{summand : mod_vtm_aufbau.typ_richtung, symbol : schnittstelle_fehlermonade<mod_vtm_aufbau.typ_symbol>;}> =
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"summand": 0,
|
|
||||||
"symbol": new klasse_nichts<mod_vtm_aufbau.typ_symbol>(),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"summand": +2,
|
|
||||||
"symbol": new klasse_schlicht<mod_vtm_aufbau.typ_symbol>(symbol_links),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"summand": -2,
|
|
||||||
"symbol": new klasse_schlicht<mod_vtm_aufbau.typ_symbol>(symbol_rechts),
|
|
||||||
},
|
|
||||||
]
|
|
||||||
;
|
|
||||||
ausgaenge.forEach
|
|
||||||
(
|
|
||||||
eintrag =>
|
|
||||||
{
|
|
||||||
let winkel : float = ((mod_vtm_aufbau.richtung_addieren(richtung, eintrag.summand) / 6) * 360);
|
|
||||||
let knoten_pfeil : mod_vtm_helfer.typ_xmlknoten = (
|
|
||||||
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
|
||||||
(
|
|
||||||
"path",
|
|
||||||
{
|
|
||||||
"d": svg_form_pfeil,
|
|
||||||
"class": (
|
|
||||||
[
|
|
||||||
"pfeil",
|
|
||||||
(
|
|
||||||
eintrag.symbol.ist_schlicht()
|
|
||||||
? "symbol_" + eintrag.symbol.lesen().toFixed(0)
|
|
||||||
: "neutral"
|
|
||||||
),
|
|
||||||
].join(" ")
|
|
||||||
),
|
|
||||||
"transform": (
|
|
||||||
[
|
|
||||||
|
|
||||||
"rotate(" + winkel.toFixed(svg_float_praezission) + ")",
|
|
||||||
"translate(0.1, 0)",
|
|
||||||
"scale(0.075)",
|
|
||||||
].join(" ")
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
kinder_feld.push(knoten_pfeil);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
,
|
|
||||||
"verwerfer": (angaben) =>
|
|
||||||
{
|
|
||||||
kinder_feld.push(knoten_rahmen());
|
|
||||||
let knoten_kreis : mod_vtm_helfer.typ_xmlknoten = (
|
|
||||||
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
|
||||||
(
|
|
||||||
"circle",
|
|
||||||
{
|
|
||||||
"cx": (0.0).toFixed(svg_float_praezission),
|
|
||||||
"cy": (0.0).toFixed(svg_float_praezission),
|
|
||||||
"r": (0.25).toFixed(svg_float_praezission),
|
|
||||||
"class": (
|
|
||||||
[
|
|
||||||
"kreis",
|
|
||||||
"negativ",
|
|
||||||
].join(" ")
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
kinder_feld.push(knoten_kreis);
|
|
||||||
}
|
|
||||||
,
|
|
||||||
"annehmer": (angaben) =>
|
|
||||||
{
|
|
||||||
kinder_feld.push(knoten_rahmen());
|
|
||||||
let knoten_kreis : mod_vtm_helfer.typ_xmlknoten = (
|
|
||||||
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
|
||||||
(
|
|
||||||
"circle",
|
|
||||||
{
|
|
||||||
"cx": (0.0).toFixed(svg_float_praezission),
|
|
||||||
"cy": (0.0).toFixed(svg_float_praezission),
|
|
||||||
"r": (0.25).toFixed(svg_float_praezission),
|
|
||||||
"class": (
|
|
||||||
[
|
|
||||||
"kreis",
|
|
||||||
"positiv",
|
|
||||||
].join(" ")
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
kinder_feld.push(knoten_kreis);
|
|
||||||
}
|
|
||||||
,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
;
|
|
||||||
let position : typ_position = position_von_stelle(svg_aktor.stelle);
|
|
||||||
let knoten_feld : mod_vtm_helfer.typ_xmlknoten = (
|
|
||||||
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
|
||||||
(
|
|
||||||
"g",
|
|
||||||
{
|
{
|
||||||
"class": "feld",
|
|
||||||
"rel": mod_vtm_aufbau.stelle_hash(svg_aktor.stelle),
|
/**
|
||||||
"transform": ("translate" + "(" + position.x.toFixed(svg_float_praezission) + ", " + position.y.toFixed(svg_float_praezission) + ")"),
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
},
|
*/
|
||||||
kinder_feld
|
export type typ_aktor =
|
||||||
)
|
{
|
||||||
);
|
aufbau : mod_vtm.mod_aufbau.mod_aktor.typ_aktor;
|
||||||
return knoten_feld;
|
stelle : mod_vtm.mod_aufbau.mod_stelle.typ_stelle;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function erstellen
|
||||||
|
(
|
||||||
|
aufbau : mod_vtm.mod_aufbau.mod_aktor.typ_aktor,
|
||||||
|
stelle : mod_vtm.mod_aufbau.mod_stelle.typ_stelle
|
||||||
|
)
|
||||||
|
: typ_aktor
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
"aufbau": aufbau,
|
||||||
|
"stelle": stelle
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function erstellen_manifestation
|
||||||
|
(
|
||||||
|
aufbau : mod_vtm.mod_aufbau.mod_aktor.typ_aktor,
|
||||||
|
stelle : mod_vtm.mod_aufbau.mod_stelle.typ_stelle
|
||||||
|
)
|
||||||
|
: typ_manifestation<mod_vtm.mod_aufbau.mod_aktor.typ_aktor>
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
"art": "aktor",
|
||||||
|
"angaben": erstellen(aufbau, stelle),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function darstellen(aktor_ : typ_aktor) : mod_vtm_helfer.typ_xmlknoten
|
||||||
|
{
|
||||||
|
let aktor : mod_vtm.mod_aufbau.mod_aktor.typ_aktor = aktor_.aufbau;
|
||||||
|
let knoten_rahmen = function () : mod_vtm_helfer.typ_xmlknoten
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
pfad
|
||||||
|
(
|
||||||
|
mod_vtm_helfer.sequenz(6).map(i => mod_vtm_helfer.vektor_polar(((i+0.5)/6) * (2*Math.PI), 0.5)),
|
||||||
|
true,
|
||||||
|
{
|
||||||
|
"class": "rahmen"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
let kinder_feld : Array<mod_vtm_helfer.typ_xmlknoten> = [];
|
||||||
|
fallunterscheidung<void>
|
||||||
|
(
|
||||||
|
aktor,
|
||||||
|
{
|
||||||
|
"erzeuger": (angaben) =>
|
||||||
|
{
|
||||||
|
kinder_feld.push(knoten_rahmen());
|
||||||
|
let richtung : mod_vtm.mod_aufbau.mod_richtung.typ_richtung = mod_vtm.mod_aufbau.mod_aktor_erzeuger.richtung_lesen(angaben);
|
||||||
|
let knoten_pfeil : mod_vtm_helfer.typ_xmlknoten = (
|
||||||
|
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
||||||
|
(
|
||||||
|
"path",
|
||||||
|
{
|
||||||
|
"d": form_pfeil,
|
||||||
|
"class": (
|
||||||
|
[
|
||||||
|
"pfeil",
|
||||||
|
"erzeuger",
|
||||||
|
].join(" ")
|
||||||
|
),
|
||||||
|
"transform": (
|
||||||
|
[
|
||||||
|
"rotate(" + ((richtung/6) * 360).toFixed(float_praezission) + ")",
|
||||||
|
"translate(-0.2, 0)",
|
||||||
|
"scale(0.12)",
|
||||||
|
].join(" ")
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
kinder_feld.push(knoten_pfeil);
|
||||||
|
}
|
||||||
|
,
|
||||||
|
"befoerderer": (angaben) =>
|
||||||
|
{
|
||||||
|
kinder_feld.push(knoten_rahmen());
|
||||||
|
let richtung : mod_vtm.mod_aufbau.mod_richtung.typ_richtung = mod_vtm.mod_aufbau.mod_aktor_befoerderer.richtung_lesen(angaben);
|
||||||
|
let knoten_pfeil : mod_vtm_helfer.typ_xmlknoten = (
|
||||||
|
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
||||||
|
(
|
||||||
|
"path",
|
||||||
|
{
|
||||||
|
"d": form_pfeil,
|
||||||
|
"class": (
|
||||||
|
[
|
||||||
|
"pfeil",
|
||||||
|
"neutral",
|
||||||
|
].join(" ")
|
||||||
|
),
|
||||||
|
"transform": (
|
||||||
|
[
|
||||||
|
"rotate(" + ((richtung/6) * 360).toFixed(float_praezission) + ")",
|
||||||
|
"translate(-0.2, 0)",
|
||||||
|
"scale(0.12)",
|
||||||
|
].join(" ")
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
kinder_feld.push(knoten_pfeil);
|
||||||
|
}
|
||||||
|
,
|
||||||
|
"schreiber": (angaben) =>
|
||||||
|
{
|
||||||
|
kinder_feld.push(knoten_rahmen());
|
||||||
|
let richtung : mod_vtm.mod_aufbau.mod_richtung.typ_richtung = mod_vtm.mod_aufbau.mod_aktor_schreiber.richtung_lesen(angaben);
|
||||||
|
let symbol : mod_vtm.mod_aufbau.mod_symbol.typ_symbol = mod_vtm.mod_aufbau.mod_aktor_schreiber.symbol_lesen(angaben);
|
||||||
|
let knoten_pfeil : mod_vtm_helfer.typ_xmlknoten = (
|
||||||
|
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
||||||
|
(
|
||||||
|
"path",
|
||||||
|
{
|
||||||
|
"d": form_pfeil,
|
||||||
|
"class": (
|
||||||
|
[
|
||||||
|
"pfeil",
|
||||||
|
"symbol_" + symbol.toFixed(0),
|
||||||
|
].join(" ")
|
||||||
|
),
|
||||||
|
"transform": (
|
||||||
|
[
|
||||||
|
"rotate(" + ((richtung/6) * 360).toFixed(float_praezission) + ")",
|
||||||
|
"translate(-0.2, 0)",
|
||||||
|
"scale(0.12)",
|
||||||
|
].join(" ")
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
kinder_feld.push(knoten_pfeil);
|
||||||
|
}
|
||||||
|
,
|
||||||
|
"leser": (angaben) =>
|
||||||
|
{
|
||||||
|
kinder_feld.push(knoten_rahmen());
|
||||||
|
let richtung : mod_vtm.mod_aufbau.mod_richtung.typ_richtung = mod_vtm.mod_aufbau.mod_aktor_leser.richtung_lesen(angaben);
|
||||||
|
let symbol_links : mod_vtm.mod_aufbau.mod_symbol.typ_symbol = mod_vtm.mod_aufbau.mod_aktor_leser.symbol_links_lesen(angaben);
|
||||||
|
let symbol_rechts : mod_vtm.mod_aufbau.mod_symbol.typ_symbol = mod_vtm.mod_aufbau.mod_aktor_leser.symbol_rechts_lesen(angaben);
|
||||||
|
let ausgaenge : Array<{summand : mod_vtm.mod_aufbau.mod_richtung.typ_richtung, symbol : schnittstelle_fehlermonade<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>;}> =
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"summand": 0,
|
||||||
|
"symbol": new klasse_nichts<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"summand": +2,
|
||||||
|
"symbol": new klasse_schlicht<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>(symbol_links),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"summand": -2,
|
||||||
|
"symbol": new klasse_schlicht<mod_vtm.mod_aufbau.mod_symbol.typ_symbol>(symbol_rechts),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
;
|
||||||
|
ausgaenge.forEach
|
||||||
|
(
|
||||||
|
eintrag =>
|
||||||
|
{
|
||||||
|
let winkel : float = ((mod_vtm.mod_aufbau.mod_richtung.addieren(richtung, eintrag.summand) / 6) * 360);
|
||||||
|
let knoten_pfeil : mod_vtm_helfer.typ_xmlknoten = (
|
||||||
|
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
||||||
|
(
|
||||||
|
"path",
|
||||||
|
{
|
||||||
|
"d": form_pfeil,
|
||||||
|
"class": (
|
||||||
|
[
|
||||||
|
"pfeil",
|
||||||
|
(
|
||||||
|
eintrag.symbol.ist_schlicht()
|
||||||
|
? "symbol_" + eintrag.symbol.lesen().toFixed(0)
|
||||||
|
: "neutral"
|
||||||
|
),
|
||||||
|
].join(" ")
|
||||||
|
),
|
||||||
|
"transform": (
|
||||||
|
[
|
||||||
|
|
||||||
|
"rotate(" + winkel.toFixed(float_praezission) + ")",
|
||||||
|
"translate(0.1, 0)",
|
||||||
|
"scale(0.075)",
|
||||||
|
].join(" ")
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
kinder_feld.push(knoten_pfeil);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
,
|
||||||
|
"verwerfer": (angaben) =>
|
||||||
|
{
|
||||||
|
kinder_feld.push(knoten_rahmen());
|
||||||
|
let knoten_kreis : mod_vtm_helfer.typ_xmlknoten = (
|
||||||
|
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
||||||
|
(
|
||||||
|
"circle",
|
||||||
|
{
|
||||||
|
"cx": (0.0).toFixed(float_praezission),
|
||||||
|
"cy": (0.0).toFixed(float_praezission),
|
||||||
|
"r": (0.25).toFixed(float_praezission),
|
||||||
|
"class": (
|
||||||
|
[
|
||||||
|
"kreis",
|
||||||
|
"negativ",
|
||||||
|
].join(" ")
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
kinder_feld.push(knoten_kreis);
|
||||||
|
}
|
||||||
|
,
|
||||||
|
"annehmer": (angaben) =>
|
||||||
|
{
|
||||||
|
kinder_feld.push(knoten_rahmen());
|
||||||
|
let knoten_kreis : mod_vtm_helfer.typ_xmlknoten = (
|
||||||
|
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
||||||
|
(
|
||||||
|
"circle",
|
||||||
|
{
|
||||||
|
"cx": (0.0).toFixed(float_praezission),
|
||||||
|
"cy": (0.0).toFixed(float_praezission),
|
||||||
|
"r": (0.25).toFixed(float_praezission),
|
||||||
|
"class": (
|
||||||
|
[
|
||||||
|
"kreis",
|
||||||
|
"positiv",
|
||||||
|
].join(" ")
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
kinder_feld.push(knoten_kreis);
|
||||||
|
}
|
||||||
|
,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
let position : mod_position.typ_position = mod_position.von_stelle(aktor_.stelle);
|
||||||
|
let knoten_feld : mod_vtm_helfer.typ_xmlknoten = (
|
||||||
|
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
||||||
|
(
|
||||||
|
"g",
|
||||||
|
{
|
||||||
|
"class": "feld",
|
||||||
|
"rel": mod_vtm.mod_aufbau.mod_stelle.hash(aktor_.stelle),
|
||||||
|
"transform": (
|
||||||
|
"translate"
|
||||||
|
+ "("
|
||||||
|
+ position.x.toFixed(float_praezission)
|
||||||
|
+ ", "
|
||||||
|
+ position.y.toFixed(float_praezission)
|
||||||
|
+ ")"
|
||||||
|
),
|
||||||
|
},
|
||||||
|
kinder_feld
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return knoten_feld;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
implementierung_manifestation["aktor"] =
|
||||||
|
{
|
||||||
|
"darstellen": (manifestation) => darstellen(manifestation.angaben),
|
||||||
|
"binden": (manifestation) => {},
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
implementierung_manifestation["svg_aktor"] =
|
|
||||||
{
|
|
||||||
"darstellen": (manifestation) => svg_aktor_darstellen(manifestation.angaben),
|
|
||||||
"binden": (manifestation) => {},
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,160 +16,182 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module mod_vtm_manifestation
|
module mod_vtm
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
export module mod_manifestation
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export type typ_svg_figur =
|
|
||||||
{
|
{
|
||||||
aufbau : mod_vtm_aufbau.typ_figur;
|
|
||||||
}
|
export module mod_svg
|
||||||
;
|
{
|
||||||
|
|
||||||
|
export module mod_figur
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function svg_figur_erstellen
|
|
||||||
(
|
|
||||||
aufbau : mod_vtm_aufbau.typ_figur
|
|
||||||
)
|
|
||||||
: typ_svg_figur
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"aufbau": aufbau,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function svg_figur_erstellen_manifestation
|
|
||||||
(
|
|
||||||
aufbau : mod_vtm_aufbau.typ_figur
|
|
||||||
)
|
|
||||||
: typ_manifestation<mod_vtm_aufbau.typ_figur>
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"art": "svg_figur",
|
|
||||||
"angaben": svg_figur_erstellen(aufbau),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function svg_figur_darstellen
|
|
||||||
(
|
|
||||||
svg_figur : typ_svg_figur
|
|
||||||
)
|
|
||||||
: mod_vtm_helfer.typ_xmlknoten
|
|
||||||
{
|
|
||||||
let figur : mod_vtm_aufbau.typ_figur = svg_figur.aufbau;
|
|
||||||
let kinder_figur : Array<mod_vtm_helfer.typ_xmlknoten> = [];
|
|
||||||
// Stein
|
|
||||||
{
|
|
||||||
let knoten_stein : mod_vtm_helfer.typ_xmlknoten = (
|
|
||||||
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
|
||||||
(
|
|
||||||
"circle",
|
|
||||||
{
|
|
||||||
"cx": (0.0).toFixed(svg_float_praezission),
|
|
||||||
"cy": (0.0).toFixed(svg_float_praezission),
|
|
||||||
"r": (0.125).toFixed(svg_float_praezission),
|
|
||||||
"class": "stein",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
kinder_figur.push(knoten_stein);
|
|
||||||
}
|
|
||||||
// Band
|
|
||||||
{
|
|
||||||
let band : Array<mod_vtm_aufbau.typ_symbol> = mod_vtm_aufbau.figur_band_lesen(figur);
|
|
||||||
let kinder_band : Array<mod_vtm_helfer.typ_xmlknoten> = [];
|
|
||||||
band.forEach
|
|
||||||
(
|
|
||||||
(symbol, index) =>
|
|
||||||
{
|
|
||||||
let r : float = 0.06125;
|
|
||||||
let x : float = (+0.1+(2*r*1.25)*index);
|
|
||||||
let y : float = (-0.1);
|
|
||||||
let knoten_eintrag : mod_vtm_helfer.typ_xmlknoten = (
|
|
||||||
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
|
||||||
(
|
|
||||||
"circle",
|
|
||||||
{
|
|
||||||
"cx": x.toFixed(svg_float_praezission),
|
|
||||||
"cy": y.toFixed(svg_float_praezission),
|
|
||||||
"r": r.toFixed(svg_float_praezission),
|
|
||||||
/*
|
|
||||||
"x": (x-r).toFixed(svg_float_praezission),
|
|
||||||
"y": (y-r).toFixed(svg_float_praezission),
|
|
||||||
"width": (2*r).toFixed(svg_float_praezission),
|
|
||||||
"height": (2*r).toFixed(svg_float_praezission),
|
|
||||||
*/
|
|
||||||
"class": (
|
|
||||||
[
|
|
||||||
"eintrag",
|
|
||||||
"symbol_" + symbol.toFixed(0),
|
|
||||||
].join(" ")
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
kinder_band.push(knoten_eintrag);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
;
|
|
||||||
let knoten_band = (
|
|
||||||
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
|
||||||
(
|
|
||||||
"g",
|
|
||||||
{
|
|
||||||
"class": "band",
|
|
||||||
},
|
|
||||||
kinder_band
|
|
||||||
)
|
|
||||||
);
|
|
||||||
kinder_figur.push(knoten_band);
|
|
||||||
}
|
|
||||||
let position : typ_position = position_von_stelle(mod_vtm_aufbau.figur_stelle_lesen(figur));
|
|
||||||
let knoten_figur = (
|
|
||||||
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
|
||||||
(
|
|
||||||
"g",
|
|
||||||
{
|
{
|
||||||
"class": "figur",
|
|
||||||
"transform": ("translate(" + position.x.toFixed(svg_float_praezission) + "," + position.y.toFixed(svg_float_praezission) + ")"),
|
/**
|
||||||
},
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
kinder_figur
|
*/
|
||||||
)
|
export type typ_figur =
|
||||||
);
|
{
|
||||||
return knoten_figur;
|
aufbau : mod_vtm.mod_aufbau.mod_figur.typ_figur;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function erstellen
|
||||||
|
(
|
||||||
|
aufbau : mod_vtm.mod_aufbau.mod_figur.typ_figur
|
||||||
|
)
|
||||||
|
: typ_figur
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
"aufbau": aufbau,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function erstellen_manifestation
|
||||||
|
(
|
||||||
|
aufbau : mod_vtm.mod_aufbau.mod_figur.typ_figur
|
||||||
|
)
|
||||||
|
: typ_manifestation<mod_vtm.mod_aufbau.mod_figur.typ_figur>
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
"art": "svg_figur",
|
||||||
|
"angaben": erstellen(aufbau),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function darstellen
|
||||||
|
(
|
||||||
|
figur_ : typ_figur
|
||||||
|
)
|
||||||
|
: mod_vtm_helfer.typ_xmlknoten
|
||||||
|
{
|
||||||
|
let figur : mod_vtm.mod_aufbau.mod_figur.typ_figur = figur_.aufbau;
|
||||||
|
let kinder_figur : Array<mod_vtm_helfer.typ_xmlknoten> = [];
|
||||||
|
// Stein
|
||||||
|
{
|
||||||
|
let knoten_stein : mod_vtm_helfer.typ_xmlknoten = (
|
||||||
|
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
||||||
|
(
|
||||||
|
"circle",
|
||||||
|
{
|
||||||
|
"cx": (0.0).toFixed(float_praezission),
|
||||||
|
"cy": (0.0).toFixed(float_praezission),
|
||||||
|
"r": (0.125).toFixed(float_praezission),
|
||||||
|
"class": "stein",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
kinder_figur.push(knoten_stein);
|
||||||
|
}
|
||||||
|
// Band
|
||||||
|
{
|
||||||
|
let band : Array<mod_vtm.mod_aufbau.mod_symbol.typ_symbol> = mod_vtm.mod_aufbau.mod_figur.band_lesen(figur);
|
||||||
|
let kinder_band : Array<mod_vtm_helfer.typ_xmlknoten> = [];
|
||||||
|
band.forEach
|
||||||
|
(
|
||||||
|
(symbol, index) =>
|
||||||
|
{
|
||||||
|
let r : float = 0.06125;
|
||||||
|
let x : float = (+0.1+(2*r*1.25)*index);
|
||||||
|
let y : float = (-0.1);
|
||||||
|
let knoten_eintrag : mod_vtm_helfer.typ_xmlknoten = (
|
||||||
|
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
||||||
|
(
|
||||||
|
"circle",
|
||||||
|
{
|
||||||
|
"cx": x.toFixed(float_praezission),
|
||||||
|
"cy": y.toFixed(float_praezission),
|
||||||
|
"r": r.toFixed(float_praezission),
|
||||||
|
/*
|
||||||
|
"x": (x-r).toFixed(float_praezission),
|
||||||
|
"y": (y-r).toFixed(float_praezission),
|
||||||
|
"width": (2*r).toFixed(float_praezission),
|
||||||
|
"height": (2*r).toFixed(float_praezission),
|
||||||
|
*/
|
||||||
|
"class": (
|
||||||
|
[
|
||||||
|
"eintrag",
|
||||||
|
"symbol_" + symbol.toFixed(0),
|
||||||
|
].join(" ")
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
kinder_band.push(knoten_eintrag);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
let knoten_band = (
|
||||||
|
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
||||||
|
(
|
||||||
|
"g",
|
||||||
|
{
|
||||||
|
"class": "band",
|
||||||
|
},
|
||||||
|
kinder_band
|
||||||
|
)
|
||||||
|
);
|
||||||
|
kinder_figur.push(knoten_band);
|
||||||
|
}
|
||||||
|
let position : mod_position.typ_position = mod_position.von_stelle(mod_vtm.mod_aufbau.mod_figur.stelle_lesen(figur));
|
||||||
|
let knoten_figur = (
|
||||||
|
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
||||||
|
(
|
||||||
|
"g",
|
||||||
|
{
|
||||||
|
"class": "figur",
|
||||||
|
"transform": (
|
||||||
|
"translate"
|
||||||
|
+ "("
|
||||||
|
+ position.x.toFixed(float_praezission)
|
||||||
|
+ ","
|
||||||
|
+ position.y.toFixed(float_praezission)
|
||||||
|
+ ")"
|
||||||
|
),
|
||||||
|
},
|
||||||
|
kinder_figur
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return knoten_figur;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function binden(figur : typ_figur) : void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
implementierung_manifestation["svg_figur"] =
|
||||||
|
{
|
||||||
|
"darstellen": (manifestation) => darstellen(manifestation.angaben),
|
||||||
|
"binden": (manifestation) => binden(manifestation.angaben),
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function svg_figur_binden(svg_figur : typ_svg_figur) : void
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
implementierung_manifestation["svg_figur"] =
|
|
||||||
{
|
|
||||||
"darstellen": (manifestation) => svg_figur_darstellen(manifestation.angaben),
|
|
||||||
"binden": (manifestation) => svg_figur_binden(manifestation.angaben),
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,135 +16,150 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module mod_vtm_manifestation
|
module mod_vtm
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
export module mod_manifestation
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export type typ_svg_partie =
|
|
||||||
{
|
{
|
||||||
aufbau : mod_vtm_aufbau.typ_partie;
|
|
||||||
}
|
export module mod_svg
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function svg_partie_erstellen(aufbau : mod_vtm_aufbau.typ_partie) : typ_svg_partie
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"aufbau": aufbau
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function svg_partie_erstellen_manifestation(aufbau : mod_vtm_aufbau.typ_partie) : typ_manifestation<mod_vtm_aufbau.typ_partie>
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"art": "svg_partie",
|
|
||||||
"angaben": svg_partie_erstellen(aufbau)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function svg_partie_darstellen(svg_partie : typ_svg_partie) : mod_vtm_helfer.typ_xmlknoten
|
|
||||||
{
|
|
||||||
let kinder_partie : Array<mod_vtm_helfer.typ_xmlknoten> = [];
|
|
||||||
// Welt
|
|
||||||
{
|
|
||||||
let kinder_welt : Array<mod_vtm_helfer.typ_xmlknoten> = [];
|
|
||||||
// Felder
|
|
||||||
{
|
{
|
||||||
let kinder_felder : Array<mod_vtm_helfer.typ_xmlknoten> = [];
|
|
||||||
mod_vtm_aufbau.welt_felder_lesen(mod_vtm_aufbau.partie_welt_lesen(svg_partie.aufbau)).forEach
|
export module mod_partie
|
||||||
(
|
|
||||||
({"stelle": stelle, "aktor": aktor}) =>
|
|
||||||
{
|
|
||||||
let manifestation_feld : typ_manifestation<mod_vtm_aufbau.typ_aktor> = svg_aktor_erstellen_manifestation(aktor, stelle);
|
|
||||||
let knoten_feld : mod_vtm_helfer.typ_xmlknoten = manifestation_darstellen(manifestation_feld);
|
|
||||||
kinder_felder.push(knoten_feld);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
;
|
|
||||||
let knoten_felder : mod_vtm_helfer.typ_xmlknoten = (
|
|
||||||
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
|
||||||
(
|
|
||||||
"g",
|
|
||||||
{
|
|
||||||
"class": "felder",
|
|
||||||
},
|
|
||||||
kinder_felder
|
|
||||||
)
|
|
||||||
|
|
||||||
);
|
|
||||||
kinder_welt.push(knoten_felder);
|
|
||||||
}
|
|
||||||
let knoten_welt : mod_vtm_helfer.typ_xmlknoten = (
|
|
||||||
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
|
||||||
(
|
|
||||||
"g",
|
|
||||||
{
|
|
||||||
"class": "welt",
|
|
||||||
},
|
|
||||||
kinder_welt
|
|
||||||
)
|
|
||||||
);
|
|
||||||
kinder_partie.push(knoten_welt);
|
|
||||||
}
|
|
||||||
// Figur
|
|
||||||
{
|
|
||||||
let figur_ : schnittstelle_fehlermonade<mod_vtm_aufbau.typ_figur> = mod_vtm_aufbau.partie_figur_lesen(svg_partie.aufbau);
|
|
||||||
if (figur_.ist_schlicht())
|
|
||||||
{
|
|
||||||
let figur : mod_vtm_aufbau.typ_figur = figur_.lesen();
|
|
||||||
let manifestation_figur : typ_manifestation<mod_vtm_aufbau.typ_figur> = svg_figur_erstellen_manifestation(figur);
|
|
||||||
let knoten_figur : mod_vtm_helfer.typ_xmlknoten = manifestation_darstellen(manifestation_figur);
|
|
||||||
kinder_partie.push(knoten_figur);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// nichts tun
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let knoten_partie : mod_vtm_helfer.typ_xmlknoten = (
|
|
||||||
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
|
||||||
(
|
|
||||||
"g",
|
|
||||||
{
|
{
|
||||||
"class": "partie",
|
|
||||||
},
|
/**
|
||||||
kinder_partie
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
)
|
*/
|
||||||
);
|
export type typ_partie =
|
||||||
return knoten_partie;
|
{
|
||||||
|
aufbau : mod_vtm.mod_aufbau.mod_partie.typ_partie;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function erstellen(aufbau : mod_vtm.mod_aufbau.mod_partie.typ_partie) : typ_partie
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
"aufbau": aufbau
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function erstellen_manifestation(aufbau : mod_vtm.mod_aufbau.mod_partie.typ_partie) : typ_manifestation<mod_vtm.mod_aufbau.mod_partie.typ_partie>
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
"art": "svg_partie",
|
||||||
|
"angaben": erstellen(aufbau)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function darstellen(partie : typ_partie) : mod_vtm_helfer.typ_xmlknoten
|
||||||
|
{
|
||||||
|
let kinder_partie : Array<mod_vtm_helfer.typ_xmlknoten> = [];
|
||||||
|
// Welt
|
||||||
|
{
|
||||||
|
let kinder_welt : Array<mod_vtm_helfer.typ_xmlknoten> = [];
|
||||||
|
// Felder
|
||||||
|
{
|
||||||
|
let kinder_felder : Array<mod_vtm_helfer.typ_xmlknoten> = [];
|
||||||
|
mod_vtm.mod_aufbau.mod_welt.felder_lesen(mod_vtm.mod_aufbau.mod_partie.welt_lesen(partie.aufbau)).forEach
|
||||||
|
(
|
||||||
|
({"stelle": stelle, "aktor": aktor}) =>
|
||||||
|
{
|
||||||
|
let manifestation_feld : typ_manifestation<mod_vtm.mod_aufbau.mod_aktor.typ_aktor> = mod_aktor.erstellen_manifestation(aktor, stelle);
|
||||||
|
let knoten_feld : mod_vtm_helfer.typ_xmlknoten = mod_manifestation.darstellen(manifestation_feld);
|
||||||
|
kinder_felder.push(knoten_feld);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
let knoten_felder : mod_vtm_helfer.typ_xmlknoten = (
|
||||||
|
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
||||||
|
(
|
||||||
|
"g",
|
||||||
|
{
|
||||||
|
"class": "felder",
|
||||||
|
},
|
||||||
|
kinder_felder
|
||||||
|
)
|
||||||
|
|
||||||
|
);
|
||||||
|
kinder_welt.push(knoten_felder);
|
||||||
|
}
|
||||||
|
let knoten_welt : mod_vtm_helfer.typ_xmlknoten = (
|
||||||
|
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
||||||
|
(
|
||||||
|
"g",
|
||||||
|
{
|
||||||
|
"class": "welt",
|
||||||
|
},
|
||||||
|
kinder_welt
|
||||||
|
)
|
||||||
|
);
|
||||||
|
kinder_partie.push(knoten_welt);
|
||||||
|
}
|
||||||
|
// Figur
|
||||||
|
{
|
||||||
|
let figur_ : schnittstelle_fehlermonade<mod_vtm.mod_aufbau.mod_figur.typ_figur> = mod_vtm.mod_aufbau.mod_partie.figur_lesen(partie.aufbau);
|
||||||
|
if (figur_.ist_schlicht())
|
||||||
|
{
|
||||||
|
let figur : mod_vtm.mod_aufbau.mod_figur.typ_figur = figur_.lesen();
|
||||||
|
let manifestation_figur : typ_manifestation<mod_vtm.mod_aufbau.mod_figur.typ_figur> = mod_figur.erstellen_manifestation(figur);
|
||||||
|
let knoten_figur : mod_vtm_helfer.typ_xmlknoten = mod_manifestation.darstellen(manifestation_figur);
|
||||||
|
kinder_partie.push(knoten_figur);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// nichts tun
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let knoten_partie : mod_vtm_helfer.typ_xmlknoten = (
|
||||||
|
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
||||||
|
(
|
||||||
|
"g",
|
||||||
|
{
|
||||||
|
"class": "partie",
|
||||||
|
},
|
||||||
|
kinder_partie
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return knoten_partie;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function binden(partie : typ_partie) : void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
implementierung_manifestation["svg_partie"] =
|
||||||
|
{
|
||||||
|
"darstellen": (manifestation) => darstellen(manifestation.angaben),
|
||||||
|
"binden": (manifestation) => binden(manifestation.angaben),
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function svg_partie_binden(svg_partie : typ_svg_partie) : void
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
implementierung_manifestation["svg_partie"] =
|
|
||||||
{
|
|
||||||
"darstellen": (manifestation) => svg_partie_darstellen(manifestation.angaben),
|
|
||||||
"binden": (manifestation) => svg_partie_binden(manifestation.angaben),
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,80 +16,90 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module mod_vtm_manifestation
|
module mod_vtm
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
export module mod_manifestation
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export const svg_float_praezission : int = 4;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export const svg_form_pfeil : string = "M +4 0 L 0 +1 L 0 -1 Z";
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function svg_pfad
|
|
||||||
(
|
|
||||||
vertices : Array<mod_vtm_helfer.typ_vektor>,
|
|
||||||
schliessen : boolean = true,
|
|
||||||
attribute : {[schlussel : string] : string} = {},
|
|
||||||
)
|
|
||||||
: mod_vtm_helfer.typ_xmlknoten
|
|
||||||
{
|
{
|
||||||
let d : string = "";
|
|
||||||
vertices.forEach
|
export module mod_svg
|
||||||
(
|
{
|
||||||
(vertex, index) =>
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export const float_praezission : int = 4;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export const form_pfeil : string = "M +4 0 L 0 +1 L 0 -1 Z";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function pfad
|
||||||
|
(
|
||||||
|
vertices : Array<mod_vtm_helfer.typ_vektor>,
|
||||||
|
schliessen : boolean = true,
|
||||||
|
attribute : {[schlussel : string] : string} = {},
|
||||||
|
)
|
||||||
|
: mod_vtm_helfer.typ_xmlknoten
|
||||||
{
|
{
|
||||||
let c : string = ((index <= 0) ? "M" : "L");
|
let d : string = "";
|
||||||
let x : string = vertex.x.toFixed(svg_float_praezission);
|
vertices.forEach
|
||||||
let y : string = vertex.y.toFixed(svg_float_praezission);
|
(
|
||||||
d += [c, x, y].join(" ");
|
(vertex, index) =>
|
||||||
|
{
|
||||||
|
let c : string = ((index <= 0) ? "M" : "L");
|
||||||
|
let x : string = vertex.x.toFixed(float_praezission);
|
||||||
|
let y : string = vertex.y.toFixed(float_praezission);
|
||||||
|
d += [c, x, y].join(" ");
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
if (schliessen)
|
||||||
|
d += "Z";
|
||||||
|
attribute["d"] = d;
|
||||||
|
return (mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert("path", attribute));
|
||||||
}
|
}
|
||||||
)
|
|
||||||
;
|
|
||||||
if (schliessen)
|
/**
|
||||||
d += "Z";
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
attribute["d"] = d;
|
*/
|
||||||
return (mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert("path", attribute));
|
export function wurzel
|
||||||
}
|
(
|
||||||
|
von_x : float,
|
||||||
|
von_y : float,
|
||||||
/**
|
bis_x : float,
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
bis_y : float,
|
||||||
*/
|
hoehe : int = 500,
|
||||||
export function svg_wurzel
|
breite : int = 500,
|
||||||
(
|
kinder : Array<mod_vtm_helfer.typ_xmlknoten> = []
|
||||||
von_x : float,
|
)
|
||||||
von_y : float,
|
: mod_vtm_helfer.typ_xmlknoten
|
||||||
bis_x : float,
|
|
||||||
bis_y : float,
|
|
||||||
hoehe : int = 500,
|
|
||||||
breite : int = 500,
|
|
||||||
kinder : Array<mod_vtm_helfer.typ_xmlknoten> = []
|
|
||||||
)
|
|
||||||
: mod_vtm_helfer.typ_xmlknoten
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
|
||||||
(
|
|
||||||
"svg",
|
|
||||||
{
|
{
|
||||||
"xmlns": "http://www.w3.org/2000/svg",
|
return (
|
||||||
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
mod_vtm_helfer.xmlknoten_normal_erstellen_erweitert
|
||||||
"width": breite.toFixed(0),
|
(
|
||||||
"height": hoehe.toFixed(0),
|
"svg",
|
||||||
"viewBox": [von_x.toFixed(4), von_y.toFixed(4), (bis_x-von_x).toFixed(4), (bis_y-von_y).toFixed(4)].join(" "),
|
{
|
||||||
},
|
"xmlns": "http://www.w3.org/2000/svg",
|
||||||
kinder,
|
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
||||||
)
|
"width": breite.toFixed(0),
|
||||||
);
|
"height": hoehe.toFixed(0),
|
||||||
|
"viewBox": [von_x.toFixed(4), von_y.toFixed(4), (bis_x-von_x).toFixed(4), (bis_y-von_y).toFixed(4)].join(" "),
|
||||||
|
},
|
||||||
|
kinder,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,454 +16,469 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module mod_vtm_manifestation
|
module mod_vtm
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
export module mod_manifestation
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function text_nachbearbeiten(text : string) : string
|
|
||||||
{
|
{
|
||||||
let regexp : RegExp = (new RegExp("\\$\{s(\\d*)\}", "g"));
|
|
||||||
return text.replace(regexp, "<span class=\"symbol_$1\"> </span>");
|
export module mod_web
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export type typ_web_partie =
|
|
||||||
{
|
|
||||||
aufbau : mod_vtm_aufbau.typ_partie;
|
|
||||||
bereich : Element;
|
|
||||||
intervall : schnittstelle_fehlermonade<any>;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function web_partie_erstellen
|
|
||||||
(
|
|
||||||
aufbau : mod_vtm_aufbau.typ_partie,
|
|
||||||
bereich : Element
|
|
||||||
)
|
|
||||||
: typ_web_partie
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"aufbau": aufbau,
|
|
||||||
"bereich": bereich,
|
|
||||||
"intervall": (new klasse_nichts<any>()),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
export function web_partie_erstellen_erweitert
|
|
||||||
(
|
|
||||||
aufbau : mod_vtm_aufbau.typ_partie,
|
|
||||||
bereich : Element
|
|
||||||
)
|
|
||||||
: typ_manifestation<mod_vtm_aufbau.typ_partie>
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"art": "web_partie",
|
|
||||||
"angaben": web_partie_erstellen(aufbau, bereich)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function web_partie_erneuern_aufgabe(web_partie : typ_web_partie) : void
|
|
||||||
{
|
|
||||||
document.querySelector("#aufgabe_text").innerHTML = (
|
|
||||||
text_nachbearbeiten
|
|
||||||
(
|
|
||||||
mod_vtm_aufbau.aufgabe_text
|
|
||||||
(
|
|
||||||
mod_vtm_aufbau.partie_aufgabe_lesen(web_partie.aufbau)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function web_partie_erneuern_welt(web_partie : typ_web_partie) : void
|
|
||||||
{
|
|
||||||
let knoten_svg : mod_vtm_helfer.typ_xmlknoten = mod_vtm_manifestation.svg_wurzel
|
|
||||||
(
|
|
||||||
-4, -4,
|
|
||||||
+4, +4,
|
|
||||||
800, 800,
|
|
||||||
[manifestation_darstellen(svg_partie_erstellen_manifestation(web_partie.aufbau))]
|
|
||||||
)
|
|
||||||
;
|
|
||||||
web_partie.bereich.innerHTML = mod_vtm_helfer.xmlknoten_darstellen(knoten_svg);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function web_partie_erneuern_figur(web_partie : typ_web_partie) : void
|
|
||||||
{
|
|
||||||
let knoten_svg : mod_vtm_helfer.typ_xmlknoten = mod_vtm_manifestation.svg_wurzel
|
|
||||||
(
|
|
||||||
-4, -4,
|
|
||||||
+4, +4,
|
|
||||||
800, 800,
|
|
||||||
[manifestation_darstellen(svg_partie_erstellen_manifestation(web_partie.aufbau))]
|
|
||||||
)
|
|
||||||
;
|
|
||||||
web_partie.bereich.innerHTML = mod_vtm_helfer.xmlknoten_darstellen(knoten_svg);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function web_partie_erneuern_modus(web_partie : typ_web_partie) : void
|
|
||||||
{
|
|
||||||
let status : string;
|
|
||||||
switch (mod_vtm_aufbau.partie_modus_lesen(web_partie.aufbau))
|
|
||||||
{
|
{
|
||||||
case mod_vtm_aufbau.modus_initial:
|
|
||||||
|
export module mod_partie
|
||||||
{
|
{
|
||||||
status = "Maschine aufbauen";
|
|
||||||
break;
|
/**
|
||||||
}
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
case mod_vtm_aufbau.modus_ungewiss:
|
*/
|
||||||
{
|
function text_nachbearbeiten(text : string) : string
|
||||||
status = "wird geprüft …";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case mod_vtm_aufbau.modus_fehlerhaft:
|
|
||||||
{
|
|
||||||
status = "fehlerhaft :/";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case mod_vtm_aufbau.modus_korrekt:
|
|
||||||
{
|
|
||||||
status = "anscheinend korrekt :)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
let meldung : string = "unbehandelter Modus";
|
|
||||||
throw (new Error(meldung));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
document.querySelector("#aufgabe_status").textContent = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function web_partie_erneuern_knoepfe(web_partie : typ_web_partie) : void
|
|
||||||
{
|
|
||||||
let modus : mod_vtm_aufbau.typ_modus = mod_vtm_aufbau.partie_modus_lesen(web_partie.aufbau);
|
|
||||||
let klasse : string;
|
|
||||||
switch (modus)
|
|
||||||
{
|
|
||||||
case mod_vtm_aufbau.modus_initial:
|
|
||||||
{
|
|
||||||
klasse = "initial";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case mod_vtm_aufbau.modus_ungewiss:
|
|
||||||
{
|
|
||||||
klasse = (
|
|
||||||
web_partie.intervall.ist_schlicht()
|
|
||||||
? "ungewiss_laufend"
|
|
||||||
: "ungewiss_stehend"
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case mod_vtm_aufbau.modus_fehlerhaft:
|
|
||||||
case mod_vtm_aufbau.modus_korrekt:
|
|
||||||
{
|
|
||||||
klasse = "fertig";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
document.querySelector("#knoepfe").setAttribute("class", klasse);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function web_partie_darstellen(web_partie : typ_web_partie) : void
|
|
||||||
{
|
|
||||||
web_partie_erneuern_aufgabe(web_partie);
|
|
||||||
web_partie_erneuern_welt(web_partie);
|
|
||||||
web_partie_erneuern_figur(web_partie);
|
|
||||||
web_partie_erneuern_modus(web_partie);
|
|
||||||
web_partie_erneuern_knoepfe(web_partie);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function web_partie_anhalten(web_partie : typ_web_partie) : void
|
|
||||||
{
|
|
||||||
if (web_partie.intervall.ist_schlicht())
|
|
||||||
{
|
|
||||||
clearInterval(web_partie.intervall.lesen());
|
|
||||||
web_partie.intervall = (new klasse_nichts<any>());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
let meldung : string = "kein Intervall gesetzt";
|
|
||||||
console.warn(meldung);
|
|
||||||
}
|
|
||||||
web_partie_erneuern_knoepfe(web_partie);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function web_partie_fortfahren(web_partie : typ_web_partie) : void
|
|
||||||
{
|
|
||||||
mod_vtm_aufbau.partie_fortfahren(web_partie.aufbau);
|
|
||||||
let modus : mod_vtm_aufbau.typ_modus = mod_vtm_aufbau.partie_modus_lesen(web_partie.aufbau);
|
|
||||||
if (modus <= 1)
|
|
||||||
{
|
|
||||||
// nichts tun
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
web_partie_anhalten(web_partie);
|
|
||||||
}
|
|
||||||
web_partie_erneuern_knoepfe(web_partie);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function web_partie_testen(web_partie : typ_web_partie) : void
|
|
||||||
{
|
|
||||||
let handle : any = setInterval(() => web_partie_fortfahren(web_partie), 500);
|
|
||||||
web_partie.intervall = (new klasse_schlicht<any>(handle));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function web_partie_bearbeiten(web_partie : typ_web_partie) : void
|
|
||||||
{
|
|
||||||
web_partie_anhalten(web_partie);
|
|
||||||
mod_vtm_aufbau.partie_zuruecksetzen(web_partie.aufbau);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function web_partie_leeren(web_partie : typ_web_partie) : void
|
|
||||||
{
|
|
||||||
mod_vtm_aufbau.partie_welt_leeren(web_partie.aufbau);
|
|
||||||
mod_vtm_aufbau.partie_zuruecksetzen(web_partie.aufbau);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
function web_partie_binden(web_partie : typ_web_partie) : void
|
|
||||||
{
|
|
||||||
let stelle_ermitteln = (target : EventTarget) =>
|
|
||||||
{
|
|
||||||
let stelle : schnittstelle_fehlermonade<mod_vtm_aufbau.typ_stelle>;
|
|
||||||
let dom_feld : Element = target["closest"](".feld");
|
|
||||||
if (dom_feld == null)
|
|
||||||
{
|
|
||||||
stelle = (new klasse_nichts<mod_vtm_aufbau.typ_stelle>());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
let rel : string = dom_feld.getAttribute("rel")
|
|
||||||
stelle = (new klasse_schlicht<mod_vtm_aufbau.typ_stelle>(mod_vtm_aufbau.stelle_von_hash(rel)));
|
|
||||||
}
|
|
||||||
return stelle;
|
|
||||||
}
|
|
||||||
;
|
|
||||||
mod_vtm_aufbau.partie_lauschen
|
|
||||||
(
|
|
||||||
web_partie.aufbau,
|
|
||||||
"aenderung_aufgabe",
|
|
||||||
(angaben) =>
|
|
||||||
{
|
|
||||||
web_partie_erneuern_aufgabe(web_partie);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
;
|
|
||||||
mod_vtm_aufbau.partie_lauschen
|
|
||||||
(
|
|
||||||
web_partie.aufbau,
|
|
||||||
"aenderung_welt",
|
|
||||||
(angaben) =>
|
|
||||||
{
|
|
||||||
web_partie_erneuern_welt(web_partie);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
;
|
|
||||||
mod_vtm_aufbau.partie_lauschen
|
|
||||||
(
|
|
||||||
web_partie.aufbau,
|
|
||||||
"aenderung_figur",
|
|
||||||
(angaben) =>
|
|
||||||
{
|
|
||||||
web_partie_erneuern_figur(web_partie);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
;
|
|
||||||
mod_vtm_aufbau.partie_lauschen
|
|
||||||
(
|
|
||||||
web_partie.aufbau,
|
|
||||||
"aenderung_modus",
|
|
||||||
(angaben) =>
|
|
||||||
{
|
|
||||||
web_partie_erneuern_modus(web_partie);
|
|
||||||
web_partie_erneuern_knoepfe(web_partie);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
;
|
|
||||||
// Links-Klick
|
|
||||||
web_partie.bereich.addEventListener
|
|
||||||
(
|
|
||||||
"click",
|
|
||||||
event =>
|
|
||||||
{
|
|
||||||
event.preventDefault();
|
|
||||||
let stelle_ : schnittstelle_fehlermonade<mod_vtm_aufbau.typ_stelle> = stelle_ermitteln(event.target);
|
|
||||||
if (stelle_.ist_schlicht())
|
|
||||||
{
|
{
|
||||||
mod_vtm_aufbau.partie_welt_feld_wechseln(web_partie.aufbau, stelle_.lesen(), false);
|
let regexp : RegExp = (new RegExp("\\$\{s(\\d*)\}", "g"));
|
||||||
|
return text.replace(regexp, "<span class=\"symbol_$1\"> </span>");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export type typ_partie =
|
||||||
{
|
{
|
||||||
console.info("-- kein Feld");
|
aufbau : mod_aufbau.mod_partie.typ_partie;
|
||||||
|
bereich : Element;
|
||||||
|
intervall : schnittstelle_fehlermonade<any>;
|
||||||
}
|
}
|
||||||
}
|
;
|
||||||
)
|
|
||||||
;
|
|
||||||
// Rechts-Klick
|
/**
|
||||||
web_partie.bereich.addEventListener
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
(
|
*/
|
||||||
"contextmenu",
|
function erstellen
|
||||||
event =>
|
(
|
||||||
{
|
aufbau : mod_aufbau.mod_partie.typ_partie,
|
||||||
event.preventDefault();
|
bereich : Element
|
||||||
let stelle_ : schnittstelle_fehlermonade<mod_vtm_aufbau.typ_stelle> = stelle_ermitteln(event.target);
|
)
|
||||||
if (stelle_.ist_schlicht())
|
: typ_partie
|
||||||
{
|
{
|
||||||
mod_vtm_aufbau.partie_welt_feld_wechseln(web_partie.aufbau, stelle_.lesen(), true);
|
return {
|
||||||
|
"aufbau": aufbau,
|
||||||
|
"bereich": bereich,
|
||||||
|
"intervall": (new klasse_nichts<any>()),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
export function erstellen_erweitert
|
||||||
|
(
|
||||||
|
aufbau : mod_aufbau.mod_partie.typ_partie,
|
||||||
|
bereich : Element
|
||||||
|
)
|
||||||
|
: typ_manifestation<mod_aufbau.mod_partie.typ_partie>
|
||||||
{
|
{
|
||||||
console.info("-- kein Feld");
|
return {
|
||||||
|
"art": "partie",
|
||||||
|
"angaben": erstellen(aufbau, bereich)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
)
|
|
||||||
;
|
/**
|
||||||
// Mausrad
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
web_partie.bereich.addEventListener
|
*/
|
||||||
(
|
function erneuern_aufgabe(partie : typ_partie) : void
|
||||||
"wheel",
|
|
||||||
event =>
|
|
||||||
{
|
|
||||||
event.preventDefault();
|
|
||||||
let stelle_ : schnittstelle_fehlermonade<mod_vtm_aufbau.typ_stelle> = stelle_ermitteln(event.target);
|
|
||||||
if (stelle_.ist_schlicht())
|
|
||||||
{
|
{
|
||||||
let inkrement : int = ((event["deltaY"] < 0) ? -1 : +1);
|
document.querySelector("#aufgabe_text").innerHTML = (
|
||||||
mod_vtm_aufbau.partie_welt_feld_drehen(web_partie.aufbau, stelle_.lesen(), inkrement);
|
text_nachbearbeiten
|
||||||
|
(
|
||||||
|
mod_vtm.mod_aufbau.mod_aufgabe.text
|
||||||
|
(
|
||||||
|
mod_vtm.mod_aufbau.mod_partie.aufgabe_lesen(partie.aufbau)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function erneuern_welt(partie : typ_partie) : void
|
||||||
{
|
{
|
||||||
console.info("-- kein Feld");
|
let knoten_svg : mod_vtm_helfer.typ_xmlknoten = mod_svg.wurzel
|
||||||
|
(
|
||||||
|
-4, -4,
|
||||||
|
+4, +4,
|
||||||
|
800, 800,
|
||||||
|
[mod_manifestation.darstellen(mod_svg.mod_partie.erstellen_manifestation(partie.aufbau))]
|
||||||
|
)
|
||||||
|
;
|
||||||
|
partie.bereich.innerHTML = mod_vtm_helfer.xmlknoten_darstellen(knoten_svg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function erneuern_figur(partie : typ_partie) : void
|
||||||
|
{
|
||||||
|
let knoten_svg : mod_vtm_helfer.typ_xmlknoten = mod_svg.wurzel
|
||||||
|
(
|
||||||
|
-4, -4,
|
||||||
|
+4, +4,
|
||||||
|
800, 800,
|
||||||
|
[mod_manifestation.darstellen(mod_svg.mod_partie.erstellen_manifestation(partie.aufbau))]
|
||||||
|
)
|
||||||
|
;
|
||||||
|
partie.bereich.innerHTML = mod_vtm_helfer.xmlknoten_darstellen(knoten_svg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function erneuern_modus(partie : typ_partie) : void
|
||||||
|
{
|
||||||
|
let status : string;
|
||||||
|
switch (mod_vtm.mod_aufbau.mod_partie.modus_lesen(partie.aufbau))
|
||||||
|
{
|
||||||
|
case mod_vtm.mod_aufbau.mod_modus.initial:
|
||||||
|
{
|
||||||
|
status = "Maschine aufbauen";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case mod_vtm.mod_aufbau.mod_modus.ungewiss:
|
||||||
|
{
|
||||||
|
status = "wird geprüft …";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case mod_vtm.mod_aufbau.mod_modus.fehlerhaft:
|
||||||
|
{
|
||||||
|
status = "fehlerhaft :/";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case mod_vtm.mod_aufbau.mod_modus.korrekt:
|
||||||
|
{
|
||||||
|
status = "anscheinend korrekt :)";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
let meldung : string = "unbehandelter Modus";
|
||||||
|
throw (new Error(meldung));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.querySelector("#aufgabe_status").textContent = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function erneuern_knoepfe(partie : typ_partie) : void
|
||||||
|
{
|
||||||
|
let modus : mod_vtm.mod_aufbau.mod_modus.typ_modus = mod_vtm.mod_aufbau.mod_partie.modus_lesen(partie.aufbau);
|
||||||
|
let klasse : string;
|
||||||
|
switch (modus)
|
||||||
|
{
|
||||||
|
case mod_vtm.mod_aufbau.mod_modus.initial:
|
||||||
|
{
|
||||||
|
klasse = "initial";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case mod_vtm.mod_aufbau.mod_modus.ungewiss:
|
||||||
|
{
|
||||||
|
klasse = (
|
||||||
|
partie.intervall.ist_schlicht()
|
||||||
|
? "ungewiss_laufend"
|
||||||
|
: "ungewiss_stehend"
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case mod_vtm.mod_aufbau.mod_modus.fehlerhaft:
|
||||||
|
case mod_vtm.mod_aufbau.mod_modus.korrekt:
|
||||||
|
{
|
||||||
|
klasse = "fertig";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.querySelector("#knoepfe").setAttribute("class", klasse);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function darstellen(partie : typ_partie) : void
|
||||||
|
{
|
||||||
|
erneuern_aufgabe(partie);
|
||||||
|
erneuern_welt(partie);
|
||||||
|
erneuern_figur(partie);
|
||||||
|
erneuern_modus(partie);
|
||||||
|
erneuern_knoepfe(partie);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function anhalten(partie : typ_partie) : void
|
||||||
|
{
|
||||||
|
if (partie.intervall.ist_schlicht())
|
||||||
|
{
|
||||||
|
clearInterval(partie.intervall.lesen());
|
||||||
|
partie.intervall = (new klasse_nichts<any>());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
let meldung : string = "kein Intervall gesetzt";
|
||||||
|
console.warn(meldung);
|
||||||
|
}
|
||||||
|
erneuern_knoepfe(partie);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function fortfahren(partie : typ_partie) : void
|
||||||
|
{
|
||||||
|
mod_vtm.mod_aufbau.mod_partie.fortfahren(partie.aufbau);
|
||||||
|
let modus : mod_vtm.mod_aufbau.mod_modus.typ_modus = mod_vtm.mod_aufbau.mod_partie.modus_lesen(partie.aufbau);
|
||||||
|
if (modus <= 1)
|
||||||
|
{
|
||||||
|
// nichts tun
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
anhalten(partie);
|
||||||
|
}
|
||||||
|
erneuern_knoepfe(partie);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function testen(partie : typ_partie) : void
|
||||||
|
{
|
||||||
|
let handle : any = setInterval(() => fortfahren(partie), 500);
|
||||||
|
partie.intervall = (new klasse_schlicht<any>(handle));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function bearbeiten(partie : typ_partie) : void
|
||||||
|
{
|
||||||
|
anhalten(partie);
|
||||||
|
mod_vtm.mod_aufbau.mod_partie.zuruecksetzen(partie.aufbau);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function leeren(partie : typ_partie) : void
|
||||||
|
{
|
||||||
|
mod_vtm.mod_aufbau.mod_partie.welt_leeren(partie.aufbau);
|
||||||
|
mod_vtm.mod_aufbau.mod_partie.zuruecksetzen(partie.aufbau);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
function binden(partie : typ_partie) : void
|
||||||
|
{
|
||||||
|
let stelle_ermitteln = (target : EventTarget) =>
|
||||||
|
{
|
||||||
|
let stelle : schnittstelle_fehlermonade<mod_vtm.mod_aufbau.mod_stelle.typ_stelle>;
|
||||||
|
let dom_feld : Element = target["closest"](".feld");
|
||||||
|
if (dom_feld == null)
|
||||||
|
{
|
||||||
|
stelle = (new klasse_nichts<mod_vtm.mod_aufbau.mod_stelle.typ_stelle>());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
let rel : string = dom_feld.getAttribute("rel")
|
||||||
|
stelle = (new klasse_schlicht<mod_vtm.mod_aufbau.mod_stelle.typ_stelle>(mod_vtm.mod_aufbau.mod_stelle.von_hash(rel)));
|
||||||
|
}
|
||||||
|
return stelle;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
mod_vtm.mod_aufbau.mod_partie.lauschen
|
||||||
|
(
|
||||||
|
partie.aufbau,
|
||||||
|
"aenderung_aufgabe",
|
||||||
|
(angaben) =>
|
||||||
|
{
|
||||||
|
erneuern_aufgabe(partie);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
mod_vtm.mod_aufbau.mod_partie.lauschen
|
||||||
|
(
|
||||||
|
partie.aufbau,
|
||||||
|
"aenderung_welt",
|
||||||
|
(angaben) =>
|
||||||
|
{
|
||||||
|
erneuern_welt(partie);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
mod_vtm.mod_aufbau.mod_partie.lauschen
|
||||||
|
(
|
||||||
|
partie.aufbau,
|
||||||
|
"aenderung_figur",
|
||||||
|
(angaben) =>
|
||||||
|
{
|
||||||
|
erneuern_figur(partie);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
mod_vtm.mod_aufbau.mod_partie.lauschen
|
||||||
|
(
|
||||||
|
partie.aufbau,
|
||||||
|
"aenderung_modus",
|
||||||
|
(angaben) =>
|
||||||
|
{
|
||||||
|
erneuern_modus(partie);
|
||||||
|
erneuern_knoepfe(partie);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
// Links-Klick
|
||||||
|
partie.bereich.addEventListener
|
||||||
|
(
|
||||||
|
"click",
|
||||||
|
event =>
|
||||||
|
{
|
||||||
|
event.preventDefault();
|
||||||
|
let stelle_ : schnittstelle_fehlermonade<mod_vtm.mod_aufbau.mod_stelle.typ_stelle> = stelle_ermitteln(event.target);
|
||||||
|
if (stelle_.ist_schlicht())
|
||||||
|
{
|
||||||
|
mod_vtm.mod_aufbau.mod_partie.welt_feld_wechseln(partie.aufbau, stelle_.lesen(), false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
console.info("-- kein Feld");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
// Rechts-Klick
|
||||||
|
partie.bereich.addEventListener
|
||||||
|
(
|
||||||
|
"contextmenu",
|
||||||
|
event =>
|
||||||
|
{
|
||||||
|
event.preventDefault();
|
||||||
|
let stelle_ : schnittstelle_fehlermonade<mod_vtm.mod_aufbau.mod_stelle.typ_stelle> = stelle_ermitteln(event.target);
|
||||||
|
if (stelle_.ist_schlicht())
|
||||||
|
{
|
||||||
|
mod_vtm.mod_aufbau.mod_partie.welt_feld_wechseln(partie.aufbau, stelle_.lesen(), true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
console.info("-- kein Feld");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
// Mausrad
|
||||||
|
partie.bereich.addEventListener
|
||||||
|
(
|
||||||
|
"wheel",
|
||||||
|
event =>
|
||||||
|
{
|
||||||
|
event.preventDefault();
|
||||||
|
let stelle_ : schnittstelle_fehlermonade<mod_vtm.mod_aufbau.mod_stelle.typ_stelle> = stelle_ermitteln(event.target);
|
||||||
|
if (stelle_.ist_schlicht())
|
||||||
|
{
|
||||||
|
let inkrement : int = ((event["deltaY"] < 0) ? -1 : +1);
|
||||||
|
mod_vtm.mod_aufbau.mod_partie.welt_feld_drehen(partie.aufbau, stelle_.lesen(), inkrement);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
console.info("-- kein Feld");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
// Schritt
|
||||||
|
document.querySelector("#knopf_schritt").addEventListener
|
||||||
|
(
|
||||||
|
"click",
|
||||||
|
event =>
|
||||||
|
{
|
||||||
|
anhalten(partie);
|
||||||
|
fortfahren(partie);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
// Testen
|
||||||
|
document.querySelector("#knopf_testen").addEventListener
|
||||||
|
(
|
||||||
|
"click",
|
||||||
|
event =>
|
||||||
|
{
|
||||||
|
testen(partie);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
// Anhalten
|
||||||
|
document.querySelector("#knopf_anhalten").addEventListener
|
||||||
|
(
|
||||||
|
"click",
|
||||||
|
event =>
|
||||||
|
{
|
||||||
|
anhalten(partie);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
// Bearbeiten
|
||||||
|
document.querySelector("#knopf_bearbeiten").addEventListener
|
||||||
|
(
|
||||||
|
"click",
|
||||||
|
event =>
|
||||||
|
{
|
||||||
|
bearbeiten(partie);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
// Leeren
|
||||||
|
document.querySelector("#knopf_leeren").addEventListener
|
||||||
|
(
|
||||||
|
"click",
|
||||||
|
event =>
|
||||||
|
{
|
||||||
|
leeren(partie);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kcf <vidofnir@folksprak.org>
|
||||||
|
*/
|
||||||
|
implementierung_manifestation["partie"] =
|
||||||
|
{
|
||||||
|
"darstellen": (manifestation) => darstellen(manifestation.angaben),
|
||||||
|
"binden": (manifestation) => binden(manifestation.angaben),
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
|
||||||
;
|
}
|
||||||
// Schritt
|
|
||||||
document.querySelector("#knopf_schritt").addEventListener
|
|
||||||
(
|
|
||||||
"click",
|
|
||||||
event =>
|
|
||||||
{
|
|
||||||
web_partie_anhalten(web_partie);
|
|
||||||
web_partie_fortfahren(web_partie);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
;
|
|
||||||
// Testen
|
|
||||||
document.querySelector("#knopf_testen").addEventListener
|
|
||||||
(
|
|
||||||
"click",
|
|
||||||
event =>
|
|
||||||
{
|
|
||||||
web_partie_testen(web_partie);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
;
|
|
||||||
// Anhalten
|
|
||||||
document.querySelector("#knopf_anhalten").addEventListener
|
|
||||||
(
|
|
||||||
"click",
|
|
||||||
event =>
|
|
||||||
{
|
|
||||||
web_partie_anhalten(web_partie);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
;
|
|
||||||
// Bearbeiten
|
|
||||||
document.querySelector("#knopf_bearbeiten").addEventListener
|
|
||||||
(
|
|
||||||
"click",
|
|
||||||
event =>
|
|
||||||
{
|
|
||||||
web_partie_bearbeiten(web_partie);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
;
|
|
||||||
// Leeren
|
|
||||||
document.querySelector("#knopf_leeren").addEventListener
|
|
||||||
(
|
|
||||||
"click",
|
|
||||||
event =>
|
|
||||||
{
|
|
||||||
web_partie_leeren(web_partie);
|
|
||||||
}
|
|
||||||
)
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kcf <vidofnir@folksprak.org>
|
|
||||||
*/
|
|
||||||
implementierung_manifestation["web_partie"] =
|
|
||||||
{
|
|
||||||
"darstellen": (manifestation) => web_partie_darstellen(manifestation.angaben),
|
|
||||||
"binden": (manifestation) => web_partie_binden(manifestation.angaben),
|
|
||||||
}
|
|
||||||
;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<script type="text/javascript" src="vtm.js"></script>
|
<script type="text/javascript" src="vtm.js"></script>
|
||||||
<script type="text/javascript" src="vtm.dat.js"></script>
|
<script type="text/javascript" src="vtm.dat.js"></script>
|
||||||
<script type="text/javascript">eingang_web();</script>
|
<script type="text/javascript">mod_vtm.eingang_web();</script>
|
||||||
<link rel="stylesheet" type="text/css" href="vtm.css"/>
|
<link rel="stylesheet" type="text/css" href="vtm.css"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue