Skip to content

Commit dff6f84

Browse files
from alpha
2 parents a0f14b8 + c890b67 commit dff6f84

21 files changed

+8478
-26258
lines changed

.DS_Store

0 Bytes
Binary file not shown.

package-lock.json

Lines changed: 8091 additions & 26082 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"es6-promise": "^4.2.8",
4747
"file-saver": "^2.0.5",
4848
"fs": "0.0.1-security",
49-
"go": "^3.0.1",
49+
"go": "^2.0.2",
5050
"gojs": "^3.0.19",
5151
"gojs-react": "^1.1.2",
5252
"graphql": "^16.10.0",
@@ -66,7 +66,7 @@
6666
"next-remove-imports": "^1.0.12",
6767
"node": "^20.19.0",
6868
"node-fetch": "^3.3.2",
69-
"npm": "^11.2.0",
69+
"npm": "^8.18.0",
7070
"phoenix": "^1.7.20",
7171
"postcss": "^8.5.3",
7272
"printf": "^0.6.1",
@@ -122,7 +122,7 @@
122122
"prettier": "^3.5.3",
123123
"pretty-quick": "^4.1.1",
124124
"promise": "^8.3.0",
125-
"react-scripts": "^5.0.1",
125+
"react-scripts": "^0.0.0",
126126
"typescript": "^5.8.2",
127127
"typescript-fsa": "^3.0.0",
128128
"typescript-fsa-reducers": "^1.2.2"
@@ -132,5 +132,6 @@
132132
"bufferutil": "^4.0.9",
133133
"fsevents": "^2.3.3",
134134
"utf-8-validate": "^6.0.5"
135-
}
135+
},
136+
"packageManager": "pnpm@10.15.0+sha512.486ebc259d3e999a4e8691ce03b5cac4a71cbeca39372a9b762cb500cfdf0873e2cb16abe3d951b1ee2cf012503f027b98b6584e4df22524e0c7450d9ec7aa7b"
136137
}

src/akmm/metamodeller.ts

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9519,45 +9519,47 @@ export class cxObjectView extends cxMetaObject {
95199519
category: string;
95209520
object: cxObject | null;
95219521
objectRef: string;
9522+
parent: string;
95229523
inputrelviews: cxRelationshipView[] | null;
95239524
outputrelviews: cxRelationshipView[] | null;
95249525
typeview: cxObjectTypeView | null;
95259526
typeviewRef: string;
9526-
figure: string;
9527-
group: string;
9528-
isGroup: boolean;
9527+
95299528
groupLayout: string;
9530-
parent: string;
9531-
isExpanded: boolean;
9532-
isSelected: boolean;
9533-
visible: boolean;
95349529
grabIsAllowed: boolean;
9530+
isExpanded: boolean;
95359531
readonly: boolean;
9532+
visible: boolean;
9533+
95369534
text: string;
9537-
loc: string;
9538-
size: string;
9539-
scale: number;
9540-
memberscale: number;
9541-
arrowscale: number;
9542-
viewkind: string;
9543-
template: string;
9544-
template2: string;
9545-
figure: string;
9546-
geometry: string;
9547-
icon: string;
9548-
image: string;
95499535
routing: string;
95509536
linkcurve: string;
9551-
fillcolor: string;
95529537
fillcolor1: string;
9538+
strokecolor1: string;
9539+
9540+
figure: string;
9541+
fillcolor: string;
95539542
fillcolor2: string;
9543+
geometry: string;
9544+
group: string;
9545+
icon: string;
9546+
image: string;
9547+
isGroup: boolean;
9548+
isSelected: boolean;
9549+
loc: string;
9550+
memberscale: number;
9551+
modified: boolean;
9552+
scale: number;
9553+
size: string;
95549554
strokecolor: string;
9555-
strokecolor1: string;
95569555
strokecolor2: string;
95579556
strokewidth: number;
9557+
template: string;
9558+
template2: string;
95589559
textcolor: string;
95599560
textcolor2: string;
95609561
textscale: number;
9562+
viewkind: string;
95619563
constructor(id: string, name: string, object: cxObject | null, description: string, modelview: cxModelView | null) {
95629564
super(id, name, description);
95639565
this.modelview = modelview;
@@ -9574,7 +9576,7 @@ export class cxObjectView extends cxMetaObject {
95749576
this.memberscale = this.typeview?.memberscale ? this.typeview.memberscale : 1.0;
95759577
this.arrowscale = this.typeview?.arrowscale ? this.typeview.arrowscale : 1.3;
95769578
this.textscale = this.typeview?.textscale ? this.typeview.textscale : 1.0;
9577-
if (false) {
9579+
if (true) {
95789580
this.group = "";
95799581
this.isGroup = false;
95809582
this.groupLayout = "";
@@ -9849,7 +9851,7 @@ export class cxObjectView extends cxMetaObject {
98499851
}
98509852
setFigure(figure: string) {
98519853
if (figure == undefined)
9852-
figure = "";
9854+
figure = "";
98539855
this.figure = figure;
98549856
}
98559857
getFigure(): string {
@@ -10157,6 +10159,8 @@ export class cxRelationshipView extends cxMetaObject {
1015710159
this.textcolor = 'black';
1015810160
break;
1015910161
default:
10162+
this.setFromArrow('');
10163+
this.textcolor = 'black';
1016010164
break;
1016110165
}
1016210166
if (debug) console.log('5773 fromArrowColor', this.fromArrowColor);
@@ -10187,9 +10191,13 @@ export class cxRelationshipView extends cxMetaObject {
1018710191
case 'Aggregation':
1018810192
case 'Composition':
1018910193
this.setToArrow('OpenTriangle');
10194+
this.setToArrowColor('black');
1019010195
this.textcolor = 'black';
1019110196
break;
1019210197
default:
10198+
this.setToArrow('OpenTriangle');
10199+
this.setToArrowColor('black');
10200+
this.textcolor = 'black';
1019310201
break;
1019410202
}
1019510203
}

src/akmm/ui_buildmodels.ts

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -334,19 +334,21 @@ export function buildGoModel(metis: akm.cxMetis, model: akm.cxModel, modelview:
334334
const object = node.object as akm.cxObject;
335335
let objtype = object?.type as akm.cxObjectType;
336336
if (!objtype) objtype = metis.findObjectType(object.typeRef);
337-
const typeview = objtype?.getDefaultTypeView() as akm.cxObjectTypeView;
338-
if (typeview) {
339-
if (!node.template) node.template = typeview.template;
340-
if (node.template === "") node.template = typeview.template;
341-
if (!node.fillcolor) node.fillcolor = typeview.fillcolor;
342-
if (node.fillcolor2 === "") node.fillcolor2 = typeview.fillcolor2;
343-
if (node.strokecolor === "") node.strokecolor = typeview.strokecolor;
344-
if (node.strokecolor2 === "") node.strokecolor2 = typeview.strokecolor2;
345-
if (node.textcolor === "") node.textcolor = typeview.textcolor;
346-
if (node.textcolor2 === "") node.textcolor2 = typeview.textcolor2;
347-
if (node.icon === "") node.icon = typeview.icon;
348-
if (node.image === "") node.image = typeview.image;
349-
if (node.viewkind === "") node.viewkind = typeview.viewkind;
337+
if (objtype.name !== 'EntityType') {
338+
const typeview = objtype?.getDefaultTypeView() as akm.cxObjectTypeView;
339+
if (typeview) {
340+
if (!node.template) node.template = typeview.template;
341+
if (node.template === "") node.template = typeview.template;
342+
if (!node.fillcolor) node.fillcolor = typeview.fillcolor;
343+
if (node.fillcolor2 === "") node.fillcolor2 = typeview.fillcolor2;
344+
if (node.strokecolor === "") node.strokecolor = typeview.strokecolor;
345+
if (node.strokecolor2 === "") node.strokecolor2 = typeview.strokecolor2;
346+
if (node.textcolor === "") node.textcolor = typeview.textcolor;
347+
if (node.textcolor2 === "") node.textcolor2 = typeview.textcolor2;
348+
if (node.icon === "") node.icon = typeview.icon;
349+
if (node.image === "") node.image = typeview.image;
350+
if (node.viewkind === "") node.viewkind = typeview.viewkind;
351+
}
350352
}
351353
}
352354
}
@@ -373,6 +375,9 @@ export function buildGoModel(metis: akm.cxMetis, model: akm.cxModel, modelview:
373375
node.text = objview.name;
374376
}
375377
let typeview = objview.typeview;
378+
if (!typeview)
379+
typeview = objview.object?.type?.typeview as akm.cxObjectTypeView;
380+
376381
if (typeview && typeview instanceof akm.cxObjectTypeView) {
377382
typeview = metis.findObjectTypeView(typeview.id);
378383
objview.setTypeView(typeview);

src/akmm/ui_common.ts

Lines changed: 95 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2569,7 +2569,7 @@ export function scaleNodeLocation(group: any, node: any): any {
25692569
deltaNy *= scale;
25702570
nx = gx + deltaNx;
25712571
ny = gy + deltaNy;
2572-
const loc = { "x": nx, "y": ny };
2572+
const loc = nx + " " + ny;
25732573
if (debug) console.log('921 node, node.loc, loc', node, node.loc, loc);
25742574
return loc;
25752575
}
@@ -2590,8 +2590,11 @@ export function scaleNodeLocation1(group: any, node: any): any {
25902590
const ny = parseInt(nodLoc[1]);
25912591
let deltaNx = (nx - gx) * scaleFactor;
25922592
let deltaNy = (ny - gy) * scaleFactor;
2593-
const loc = { "x": nx, "y": ny };
2594-
return loc;
2593+
const deltaX = nx - deltaNx;
2594+
const deltaY = ny - deltaNy;
2595+
const loc1 = deltaX + " " + deltaY;
2596+
const loc2 = nx + " " + ny;
2597+
return loc2;
25952598
}
25962599

25972600
export function scaleNodeLocation2(node: any, refloc: string, toloc: any, scaleFactor: any): any {
@@ -2611,7 +2614,7 @@ export function scaleNodeLocation2(node: any, refloc: string, toloc: any, scaleF
26112614
if (debug) console.log('1159 rx, ry, nx, ny, deltaNx, deltaNy', rx, ry, nx, ny, deltaNx, deltaNy);
26122615
nx = rx + deltaNx;
26132616
ny = ry + deltaNy;
2614-
const loc = { "x": nx, "y": ny };
2617+
const loc = nx + " " + ny;
26152618
if (debug) console.log('1163 node, node.loc, loc', node, node.loc, loc);
26162619
return loc;
26172620
}
@@ -2711,6 +2714,7 @@ export function isPropIncluded(k: string, type: akm.cxType): boolean {
27112714
if (k === 'points') retVal = false;
27122715
if (k === 'propertyValues') retVal = false;
27132716
if (k === 'relship') retVal = false;
2717+
if (k === 'relshipkind') retVal = false;
27142718
if (k === 'relshipRef') retVal = false;
27152719
if (k === 'relshiptype') retVal = false;
27162720
if (k === 'relview') retVal = false;
@@ -2746,7 +2750,7 @@ export function isPropIncluded(k: string, type: akm.cxType): boolean {
27462750
// if (k === 'viewkind') retVal = false;
27472751
if (k === 'visible') retVal = false;
27482752
// if (k === 'viewkind') retVal = false;
2749-
if (k === 'relshipkind') retVal = false;
2753+
// if (k === 'relshipkind') retVal = false;
27502754
if (type?.name !== 'ViewFormat' &&
27512755
type?.name !== 'Datatype' &&
27522756
type?.name !== 'Property') {
@@ -4647,3 +4651,89 @@ export function fullFillGoModel(myGoModel: gjs.goModel, myModelView: akm.cxModel
46474651
return myGoModel;
46484652
}
46494653

4654+
/**
4655+
* Returns the parent group for a given cxObjectView, if one exists.
4656+
* This example assumes that the child's "group" property holds the parent’s id
4657+
* and that you have access to the current model view (e.g. "currentModelView")
4658+
* which can be used to find an object view by its id.
4659+
*
4660+
* Modify this implementation to suit your project’s structure.
4661+
*
4662+
* @param ov The child cxObjectView.
4663+
* @returns The parent cxObjectView if found, otherwise null.
4664+
*/
4665+
export function getParent(ov: cxObjectView): cxObjectView | null {
4666+
if (ov && ov.group) {
4667+
// Assuming you have a reference to the current model view.
4668+
// For example, if it's globally accessible via "currentModelView":
4669+
const currentModelView = ov.modelview; // Replace with your actual model view reference
4670+
return currentModelView.findObjectView(ov.group);
4671+
}
4672+
return null;
4673+
}
4674+
4675+
4676+
/**
4677+
* Recursively calculates the effective scale for a member view by accumulating the scale factors
4678+
* of all its ancestor groups using the global getParent function.
4679+
*
4680+
* @param member - The child cxObjectView whose effective scale is to be calculated.
4681+
* @returns The effective scale as a number.
4682+
*/
4683+
function getEffectiveScale(member: cxObjectView): number {
4684+
let effectiveScale = member.scale || 1.0;
4685+
let currentParent = getParent(member);
4686+
while (currentParent) {
4687+
effectiveScale *= (currentParent.scale || 1.0) * (currentParent.memberscale || 1.0);
4688+
currentParent = getParent(currentParent);
4689+
}
4690+
return effectiveScale;
4691+
}
4692+
4693+
/**
4694+
* Calculates and returns the new (x,y) position and (width, height) for a member object view,
4695+
* based on the recursively accumulated effective scale. Assumes that member.loc is in the format "x y"
4696+
* and member.size is in the format "width height".
4697+
*
4698+
* @param member - The child cxObjectView to be repositioned and resized.
4699+
* @returns An object containing the calculated x, y, width and height.
4700+
*/
4701+
function calculateRecursiveMemberLayout(member: cxObjectView): { x: number; y: number; width?: number; height?: number } {
4702+
const effectiveScale = getEffectiveScale(member);
4703+
let x = 0, y = 0;
4704+
let width: number | undefined, height: number | undefined;
4705+
4706+
if (member.loc) {
4707+
const parts = member.loc.split(" ").map(s => parseFloat(s.trim()));
4708+
if (parts.length >= 2 && !isNaN(parts[0]) && !isNaN(parts[1])) {
4709+
x = parts[0] * effectiveScale;
4710+
y = parts[1] * effectiveScale;
4711+
}
4712+
}
4713+
4714+
if (member.size) {
4715+
const parts = member.size.split(" ").map(s => parseFloat(s.trim()));
4716+
if (parts.length >= 2 && !isNaN(parts[0]) && !isNaN(parts[1])) {
4717+
width = parts[0] * effectiveScale;
4718+
height = parts[1] * effectiveScale;
4719+
}
4720+
}
4721+
4722+
return { x, y, width, height };
4723+
}
4724+
4725+
/**
4726+
* Updates the member's 'loc' and 'size' properties using the recursively computed effective scale.
4727+
*
4728+
* @param member - The cxObjectView to update.
4729+
*/
4730+
export function updateRecursiveMemberLayout(member: cxObjectView): void {
4731+
const layout = calculateRecursiveMemberLayout(member);
4732+
member.loc = `${layout.x} ${layout.y}`;
4733+
4734+
if (layout.width !== undefined && layout.height !== undefined) {
4735+
member.size = `${layout.width} ${layout.height}`;
4736+
}
4737+
4738+
console.log(`Updated recursive layout for ${member.id}: loc=${member.loc}, size=${member.size}`);
4739+
}

src/akmm/ui_generateTypes.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,6 +1809,7 @@ export function generateMetamodel(objects: akm.cxObject[], relships: akm.cxRelat
18091809
// if (!toObjview) continue;
18101810
// let toObj = toObjview?.object as akm.cxObject;
18111811
// toObj = myModel.findObjectByName(toObj.name);
1812+
if (rel.name === constants.types.AKM_CONTAINS)
18121813
if (rel.name === constants.types.AKM_IS) {
18131814
for (let j = 0; j < objecttypes.length; j++) {
18141815
const otype1 = objecttypes[j];
@@ -2035,6 +2036,10 @@ export function configureMetamodel(object: akm.cxObject, myMetis: akm.cxMetis, m
20352036
}
20362037
} else {
20372038
myMetamodel.description = object.description;
2039+
const container = myMetis.findObjectTypeByName(constants.types.AKM_CONTAINER);
2040+
myMetamodel.addObjectType(container);
2041+
const label = myMetis.findObjectTypeByName(constants.types.AKM_LABEL);
2042+
myMetamodel.addObjectType(label);
20382043
}
20392044
// Do the configuration
20402045
const isType = myMetis.findRelationshipTypeByName(constants.types.AKM_IS);

src/akmm/ui_gojs.ts

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -437,26 +437,34 @@ export class goObjectNode extends goNode {
437437
rightPorts: akm.cxPort[] | null;
438438
topPorts: akm.cxPort[] | null;
439439
bottomPorts: akm.cxPort[] | null;
440-
template: string;
441-
template2: string;
440+
441+
grabIsAllowed: boolean;
442+
isExpanded: boolean;
443+
444+
// arrowscale: number;
442445
figure: string;
443-
geometry: string;
444-
strokewidth: string;
445446
fillcolor: string;
446447
fillcolor2: string;
448+
geometry: string;
449+
group: string;
450+
icon: string;
451+
image: string;
452+
isGroup: boolean | "";
453+
isSelected: boolean | "";
454+
loc: string;
455+
memberscale: float;
456+
scale: float;
457+
size: float;
447458
strokecolor: string;
448459
strokecolor2: string;
460+
strokewidth: string;
461+
template: string;
462+
template2: string;
449463
textcolor: string;
450464
textcolor2: string;
451465
textscale: string;
452-
icon: string;
453-
image: string;
454-
grabIsAllowed: boolean;
455-
isGroup: boolean | "";
456-
isExpanded: boolean | "";
457-
isSelected: boolean | "";
466+
458467
groupLayout: string;
459-
group: string;
460468
parent: string;
461469
constructor(key: string, model: goModel, objview: akm.cxObjectView) {
462470
super(key, model);

0 commit comments

Comments
 (0)