7
// Multi-select move offset
10
// Drawing Globals -- For while in transit drawing
17
// List of identifiers
18
// List of selected object identifiers
20
var Objects = new Array();
21
var Selected = new Array();
22
var Identifiers = new Array();
26
// User Interface Mode Variables
28
var dragsensitivity = 12;
33
User interface callbacks
35
function handler_mouseup()
38
// Either select on/off for multi or single select
40
if(Selected[downRes.objid]) {
41
Selected[downRes.objid] = false;
43
Selected[downRes.objid] = true;
46
if(ContextObj == downRes.objid) {
49
ContextObj = downRes.objid;
52
} else if(clickstate == 8) {
53
// Draw Attribute Line
54
upRes=mouseover(gridx,gridy);
55
if(upRes.code != "None") {
56
obj = Objects[downRes.objid];
57
if(upRes.typ == "ERAttribute" || upRes.typ == "Entity" || upRes.typ == "ERRel") {
58
obj.DrawtoID = upRes.objid;
59
obj.DrawfromSide = downRes.side;
60
if(upRes.side != "None") {
61
obj.DrawtoSide = upRes.side;
62
obj.DrawtoPerc = upRes.sideperc;
64
upobj = Objects[downRes.objid];
67
var x1g = Math.abs(upRes.x1 - gridx);
68
var x2g = Math.abs(upRes.x2 - gridx);
69
var y1g = Math.abs(upRes.y1 - gridy);
70
var y2g = Math.abs(upRes.y2 - gridy);
71
if(x1g <= x2g && x1g <= y1g && x1g <= y2g){
73
perco = makesideperc(gridy, upRes.y1, upRes.y2);
74
} else if(x2g <= x1g && x2g <= y1g && x2g <= y2g){
76
perco = makesideperc(gridy, upRes.y1, upRes.y2);
77
} else if(y1g <= x1g && y1g <= x2g && y1g <= y2g){
79
perco = makesideperc(gridx, upRes.x1, upRes.x2);
80
} else if(y2g <= x1g && y2g <= x2g && y2g <= y1g){
82
perco = makesideperc(gridx, upRes.x1, upRes.x2);
85
obj.DrawtoPerc = perco;
87
if(upRes.typ == "ERAttribute" || upRes.typ == "ERRel") obj.DrawtoPerc = 0.5;
90
} else if(clickstate == 9) {
91
// Draw Relationship line
92
upRes = mouseover(gridx, gridy);
93
if(upRes.code != "None") {
94
obj = Objects[downRes.objid];
95
if(upRes.side != "None") {
96
if(obj.DrawtoID == "None") {
97
obj.DrawtoID = upRes.objid;
98
obj.DrawtoSide = upRes.side;
99
obj.DrawtoPerc = upRes.sideperc;
100
obj.DrawfromSide = downRes.side;
102
obj.DrawtoIDDest = upRes.objid;
103
obj.DrawtoSideDest = upRes.side;
104
obj.DrawtoPercDest = upRes.sideperc;
105
obj.DrawfromSideDest = downRes.side;
108
upobj = Objects[downRes.objid];
111
var x1g = Math.abs(upRes.x1-gridx);
112
var x2g = Math.abs(upRes.x2-gridx);
113
var y1g = Math.abs(upRes.y1-gridy);
114
var y2g = Math.abs(upRes.y2-gridy);
115
if(x1g <= x2g && x1g <= y1g && x1g <= y2g) {
117
perco = makesideperc(gridy, upRes.y1, upRes.y2);
118
} else if(x2g <= x1g && x2g <= y1g && x2g <= y2g) {
120
perco = makesideperc(gridy, upRes.y1, upRes.y2);
121
} else if(y1g <= x1g && y1g <= x2g && y1g <= y2g) {
123
perco = makesideperc(gridx, upRes.x1, upRes.x2);
124
} else if(y2g <= x1g && y2g <= x2g && y2g <= y1g){
126
perco = makesideperc(gridx, upRes.x1, upRes.x2);
128
if(obj.DrawtoID == "None") {
129
obj.DrawtoID = upRes.objid;
130
obj.DrawtoSide = sid;
131
obj.DrawtoPerc = perco;
132
obj.DrawfromSide = downRes.side;
134
obj.DrawtoIDDest = upRes.objid;
135
obj.DrawtoSideDest = sid;
136
obj.DrawtoPercDest = perco;
137
obj.DrawfromSideDest = downRes.side;
149
function handler_mousedown() {
151
downRes = mouseover(gridx, gridy);
159
function handler_mousemove(cx, cy) {
7
// Multi-select move offset
11
// Drawing Globals -- For while in transit drawing
19
var Objects = new Array();
21
// List of identifiers
22
var Selected = new Array();
24
// List of selected object identifiers
25
var Identifiers = new Array();
32
// User Interface Mode Variables
34
var dragsensitivity = 12;
39
* User interface callbacks
41
function handler_mouseup() {
44
// Either select on/off for multi or single select
46
if(Selected[downRes.objid]) {
47
Selected[downRes.objid] = false;
49
Selected[downRes.objid] = true;
52
if(ContextObj == downRes.objid) {
55
ContextObj = downRes.objid;
58
} else if(clickstate == 8) {
60
// Draw Attribute Line
61
upRes=mouseover(gridx,gridy);
62
if(upRes.code != "None") {
63
obj = Objects[downRes.objid];
64
if(upRes.typ == "ERAttribute" || upRes.typ == "Entity" || upRes.typ == "ERRel") {
65
obj.DrawtoID = upRes.objid;
66
obj.DrawfromSide = downRes.side;
67
if(upRes.side != "None") {
68
obj.DrawtoSide = upRes.side;
69
obj.DrawtoPerc = upRes.sideperc;
71
upobj = Objects[downRes.objid];
74
var x1g = Math.abs(upRes.x1 - gridx);
75
var x2g = Math.abs(upRes.x2 - gridx);
76
var y1g = Math.abs(upRes.y1 - gridy);
77
var y2g = Math.abs(upRes.y2 - gridy);
78
if(x1g <= x2g && x1g <= y1g && x1g <= y2g){
80
perco = makesideperc(gridy, upRes.y1, upRes.y2);
81
} else if(x2g <= x1g && x2g <= y1g && x2g <= y2g){
83
perco = makesideperc(gridy, upRes.y1, upRes.y2);
84
} else if(y1g <= x1g && y1g <= x2g && y1g <= y2g){
86
perco = makesideperc(gridx, upRes.x1, upRes.x2);
87
} else if(y2g <= x1g && y2g <= x2g && y2g <= y1g){
89
perco = makesideperc(gridx, upRes.x1, upRes.x2);
92
obj.DrawtoPerc = perco;
94
if(upRes.typ == "ERAttribute" || upRes.typ == "ERRel") obj.DrawtoPerc = 0.5;
97
} else if(clickstate == 9) {
99
// Draw Relationship line
100
upRes = mouseover(gridx, gridy);
101
if(upRes.code != "None") {
102
obj = Objects[downRes.objid];
103
if(upRes.side != "None") {
104
if(obj.DrawtoID == "None") {
105
obj.DrawtoID = upRes.objid;
106
obj.DrawtoSide = upRes.side;
107
obj.DrawtoPerc = upRes.sideperc;
108
obj.DrawfromSide = downRes.side;
110
obj.DrawtoIDDest = upRes.objid;
111
obj.DrawtoSideDest = upRes.side;
112
obj.DrawtoPercDest = upRes.sideperc;
113
obj.DrawfromSideDest = downRes.side;
116
upobj = Objects[downRes.objid];
119
var x1g = Math.abs(upRes.x1-gridx);
120
var x2g = Math.abs(upRes.x2-gridx);
121
var y1g = Math.abs(upRes.y1-gridy);
122
var y2g = Math.abs(upRes.y2-gridy);
123
if(x1g <= x2g && x1g <= y1g && x1g <= y2g) {
125
perco = makesideperc(gridy, upRes.y1, upRes.y2);
126
} else if(x2g <= x1g && x2g <= y1g && x2g <= y2g) {
128
perco = makesideperc(gridy, upRes.y1, upRes.y2);
129
} else if(y1g <= x1g && y1g <= x2g && y1g <= y2g) {
131
perco = makesideperc(gridx, upRes.x1, upRes.x2);
132
} else if(y2g <= x1g && y2g <= x2g && y2g <= y1g){
134
perco = makesideperc(gridx, upRes.x1, upRes.x2);
136
if(obj.DrawtoID == "None") {
137
obj.DrawtoID = upRes.objid;
138
obj.DrawtoSide = sid;
139
obj.DrawtoPerc = perco;
140
obj.DrawfromSide = downRes.side;
142
obj.DrawtoIDDest = upRes.objid;
143
obj.DrawtoSideDest = sid;
144
obj.DrawtoPercDest = perco;
145
obj.DrawfromSideDest = downRes.side;
157
function handler_mousedown() {
159
downRes = mouseover(gridx, gridy);
167
function handler_mousemove(cx, cy) {
160
168
// gridx=Math.round((cx-(gridsize/2.0))/gridsize)*gridsize;
161
169
// gridy=Math.round((cy-(gridsize/2.0))/gridsize)*gridsize;
164
deltax = startx - gridx;
165
deltay = starty - gridy;
166
// We start drag mode
167
if((distance(gridx, gridy, startx, starty) > dragsensitivity) && clickstate == 1) {
170
// We are in drag mode
171
if(clickstate == 2) {
172
// Single Object Move - If Not Selected, Or if Selected and Center Area Is Dragged
173
if((downRes.typ == "Entity" || downRes.typ == "ERAttribute" || downRes.typ == "ERRel") && (downRes.code == "NonSel" || (downRes.code == "Cont" && downRes.side == "None") || (downRes.code == "ContDraw" && downRes.side == "None"))) {
176
// Single Object Scale Left
177
if((downRes.typ == "Entity" || downRes.typ == "ERAttribute") && (downRes.code == "Cont" && downRes.side == "1")) {
180
// Single Object Scale Bottom
181
if((downRes.typ == "Entity" || downRes.typ == "ERAttribute") && (downRes.code == "Cont" && downRes.side == "2")) {
184
// Single Object Scale Right
185
if((downRes.typ == "Entity" || downRes.typ == "ERAttribute") && (downRes.code == "Cont" && downRes.side == "3")) {
188
// Single Object Scale Top
189
if((downRes.typ == "Entity" || downRes.typ == "ERAttribute") && (downRes.code == "Cont" && downRes.side == "4")) {
192
if(downRes.typ == "ERAttribute" && downRes.code == "ContDraw" && downRes.side != "None") {
193
clickstate=8; // Attribute Connection Draw
194
drawlinekind=1; // Tell drawing engine to draw attribute line symbol
195
if(downRes.side == "1") {
196
drawlinesx = downRes.x1; // Initiate start parameters for line drawing left side
197
drawlinesy = downRes.y1 + ((downRes.y2 - downRes.y1) * 0.5);
198
} else if(downRes.side == "2") {
199
drawlinesx = downRes.x1 + ((downRes.x2 - downRes.x1) * 0.5); // Initiate start parameters for line drawing bottom side
200
drawlinesy = downRes.y2;
201
} else if(downRes.side == "3") {
202
drawlinesx = downRes.x2; // Initiate start parameters for line drawing left side
203
drawlinesy = downRes.y1 + ((downRes.y2 - downRes.y1) * 0.5);
204
} else if(downRes.side == "4") {
205
drawlinesx = downRes.x1 + ((downRes.x2 - downRes.x1) * 0.5); // Initiate start parameters for line drawing bottom side
206
drawlinesy = downRes.y1;
208
drawlinedx = drawlinesx;
209
drawlinedy = drawlinesy;
211
if(downRes.typ == "ERRel" && downRes.code == "ContDraw" && downRes.side != "None") {
212
var obj=Objects[downRes.objid];
213
if(downRes.side != obj.DrawfromSide && downRes.side != obj.DrawfromSideDest) {
214
clickstate = 9; // Attribute Connection Draw
215
drawlinekind = 1; // Tell drawing engine to draw relation line symbol
216
if(downRes.side == "1") {
217
drawlinesx = downRes.x1; // Initiate start parameters for line drawing left side
218
drawlinesy = downRes.y1 + ((downRes.y2 - downRes.y1) * 0.5);
219
} else if(downRes.side == "2") {
220
drawlinesx = downRes.x1 + ((downRes.x2 - downRes.x1) * 0.5); // Initiate start parameters for line drawing bottom side
221
drawlinesy = downRes.y2;
222
} else if(downRes.side == "3") {
223
drawlinesx = downRes.x2; // Initiate start parameters for line drawing left side
224
drawlinesy = downRes.y1 + ((downRes.y2 - downRes.y1) * 0.5);
225
} else if(downRes.side == "4") {
226
drawlinesx = downRes.x1 + ((downRes.x2 - downRes.x1) * 0.5); // Initiate start parameters for line drawing bottom side
227
drawlinesy = downRes.y1;
229
drawlinedx = drawlinesx;
230
drawlinedy = drawlinesy;
235
var obj = Objects[downRes.objid];
237
if(clickstate == 3) { // We are in single rectangular object move
238
obj.x1 = downRes.x1 - deltax;
239
obj.y1 = downRes.y1 - deltay;
240
obj.x2 = downRes.x2 - deltax;
241
obj.y2 = downRes.y2 - deltay;
242
} else if(clickstate == 4) { // We are in single rectangular object scale left
243
if((obj.x2 - downRes.x1 + deltax) > 60) obj.x1 = downRes.x1 - deltax;
244
} else if(clickstate == 5) { // We are in single rectangular object scale bottom
245
if((downRes.y2 - obj.y1 - deltay) > 40) obj.y2 = downRes.y2 - deltay;
246
} else if(clickstate==6) { // We are in single rectangular object scale right
247
if((downRes.x2 - obj.x1 - deltax) > 60) obj.x2 = downRes.x2 - deltax;
248
} else if(clickstate == 7) { // We are in single rectangular object scale top
249
if((obj.y2 - downRes.y1 + deltay) > 40) obj.y1 = downRes.y1 - deltay;
250
} else if(clickstate == 8 || clickstate == 9) { // We are in straight connective line drawing mode
257
* Call-forward for mouse-over event
259
function mouseover(x, y) {
260
// Code of touch, and if available object id and id of side of object that was touched
261
// Tolerances included as constant
262
var obj_code = "None";
264
var obj_sidentifier =" None";
265
var obj_sideperc = 0;
266
var obj_centerdist = 0;
267
var obj_type = "None";
275
for(j = 0; j < Identifiers.length; j++) {
276
var objid = Identifiers[j];
277
var obj = Objects[objid];
278
var Sel = Selected[objid];
279
if(ContextObj == objid) {
284
// Compute coordinates including offset
285
if(obj.type == "Entity" || obj.type == "ERAttribute" || obj.type == "ERRel") {
290
rx = (x2 - x1) * 0.5;
291
ry = (y2 - y1) * 0.5;
294
// For each kind of clickable object, check if we are inside object and if so assign variables
295
// Any general properties for all object types are set when "found" is true
296
if(obj.type == "Entity") {
297
if(x > (x1 - sidetol) && y > (y1 - sidetol ) && x < (x2 + sidetol) && y < (y2 + sidetol)) {
305
side = computeside(x, y, x1, y1, x2, y2, sidetol);
306
obj_sidentifier = side.side;
307
obj_sideperc = side.perc;
308
obj_centerdist = side.dist;
311
} else if(obj.type=="ERAttribute") {
312
if(x > (x1 - sidetol) && y > (y1 - sidetol) && x < (x2 + sidetol) && y < (y2 + sidetol)) {
318
if(obj.DrawtoID == "None") {
319
obj_code = "ContDraw";
324
side = computeside(x, y, x1, y1, x2, y2, sidetol);
325
obj_sidentifier = side.side;
326
obj_sideperc = side.perc;
327
obj_centerdist = side.dist;
330
} else if(obj.type == "ERRel") {
331
if(x > (x1 - sidetol) && y > (y1 - sidetol) && x < (x2 + sidetol) && y < (y2 + sidetol)) {
333
// Colision detection against diamond
336
if(y > (y1 + ry - xk - sidetol) && y < (y1 + ry + xk + sidetol)) {
340
if(y > (y1 - rx + xk - sidetol) && y < ( y2 + rx - xk + sidetol)) {
345
if((x > (x1 - sidetol)) && (x < (x1 + sidetol)) && (y > (y1 + ry - sidetol)) && (y < (y1 + ry + sidetol))) {
348
if((x > (x1 + rx - sidetol)) && (x < (x1 + rx + sidetol)) && (y > (y2 - sidetol)) && (y < (y2 + sidetol))) {
351
if((x > (x2 - sidetol)) && (x < (x2 + sidetol)) && (y > (y1 + ry - sidetol)) && (y < (y1 + ry + sidetol))) {
354
if((x > (x1 + rx - sidetol)) && (x < (x1 + rx + sidetol)) && (y > (y1 - sidetol)) && (y < (y1 + sidetol))) {
362
if(obj.DrawtoID == "None"){
363
obj_code = "ContDraw";
364
} else if(obj.DrawtoIDDest == "None") {
365
obj_code = "ContDraw";
376
// Save coordinates at time of click
383
printstr=obj_id + " " + obj_sidentifier + " " + obj_sideperc;
389
side:obj_sidentifier,
390
sideperc:obj_sideperc,
391
centerdist:obj_centerdist,
403
function importdata() {
404
for(i = 0; i < 7; i++) {
406
obj = jQuery.parseJSON('{"type":"ERAttribute","id":"ATT1","kind":"Multiple","name":"Addressfosoppooo","x1":220,"y1":100,"x2":300,"y2":140, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"None", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":""}');
409
obj = jQuery.parseJSON('{"type":"Entity","id":"ENT2","kind":"Weak","name":"Carsmashoepppoloo","x1":100,"y1":160,"x2":220,"y2":220}');
412
obj = jQuery.parseJSON('{"type":"ERAttribute","id":"ATT3","kind":"Key","name":"SSNFooomesPoo","x1":160,"y1":260,"x2":260,"y2":300, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"None", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":""}');
415
obj = jQuery.parseJSON('{"type":"Entity","id":"ENT4","kind":"Strong","name":"Trailerfpdddpeoooooe","x1":320,"y1":260,"x2":420,"y2":320}');
418
obj = jQuery.parseJSON('{"type":"Entity","id":"ENT5","kind":"Strong","name":"Grail","x1":120,"y1":440,"x2":220,"y2":480}');
421
obj = jQuery.parseJSON('{"type":"ERRel","id":"REL6","kind":"Strong","name":"FGFool","x1":460,"y1":160,"x2":520,"y2":220, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"0", "DrawtoCard":"N", "DrawtoRole":"Fumo", "DrawtoXoffs":"20", "DrawtoYoffs":"50", "DrawtoIDDest":"None", "DrawfromSideDest":"None","DrawtoSideDest":"None", "DrawtoPercDest":"0", "DrawtoDestCard":"N", "DrawtoDestRole":"Luma", "DrawtoDestXoffs":"0", "DrawtoDestYoffs":"-50", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":"","DrawX3":"", "DrawY3":"", "DrawX4":"","DrawY4":""}');
424
obj = jQuery.parseJSON('{"type":"ERRel","id":"REL7","kind":"Weak","name":"PODrool","x1":360,"y1":360,"x2":420,"y2":420, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"0", "DrawtoCard":"N", "DrawtoRole":"Kumo", "DrawtoXoffs":"60", "DrawtoYoffs":"70", "DrawtoIDDest":"None", "DrawfromSideDest":"None","DrawtoSideDest":"None", "DrawtoPercDest":"0", "DrawtoDestCard":"N", "DrawtoDestRole":"Zuuma", "DrawtoDestXoffs":"40", "DrawtoDestYoffs":"50", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":"","DrawX3":"", "DrawY3":"", "DrawX4":"","DrawY4":""}');
427
Objects[objid] = obj;
428
Identifiers.push(objid);
434
* Prepares all kinds of objects, with local movement-offset (scrolling offset is handled with transforms??)
435
* Ofss in prepare are not finished.
437
function prepareobj(obji) {
438
var fromobj = Objects[obji];
439
// Attributes are prepared by re-pointing the DrawX1, DrawY1, DrawX2 and DrawY2 variables and Relationships are prepared by re-pointing DrawX1-DrawX4 and DrawY1-DrawY4
440
if((fromobj.type == "ERAttribute" || fromobj.type == "ERRel") && fromobj.DrawtoID != "None") {
441
var toid = fromobj.DrawtoID;
442
var toobj = Objects[toid];
444
if(fromobj.DrawtoIDDest != "None" && fromobj.DrawtoIDDest != undefined) {
445
var toiddest = fromobj.DrawtoIDDest;
446
var toobjdest = Objects[toiddest];
447
sidek = makeside(fromobj.DrawfromSideDest, fromobj.x1, fromobj.y1, fromobj.x2, fromobj.y2, 0.5);
448
fromobj.DrawX3 = sidek.x;
449
fromobj.DrawY3 = sidek.y;
450
sidek = makeside(fromobj.DrawtoSideDest, toobjdest.x1, toobjdest.y1, toobjdest.x2, toobjdest.y2, fromobj.DrawtoPercDest);
451
fromobj.DrawX4 = sidek.x;
452
fromobj.DrawY4 = sidek.y;
454
//printstr=fromobj.DrawfromSide+" "+fromobj.x1+" "+fromobj.y1+" "+fromobj.x2+" "+fromobj.y2+" :: "+fromobj.DrawtoSide+" "+toobj.x1+" "+toobj.y1+" "+toobj.x2+" "+toobj.y2+" "+fromobj.DrawtoPerc;
455
sidek = makeside(fromobj.DrawfromSide, fromobj.x1, fromobj.y1, fromobj.x2, fromobj.y2, 0.5);
456
fromobj.DrawX1 = sidek.x;
457
fromobj.DrawY1 = sidek.y;
458
sidek = makeside(fromobj.DrawtoSide, toobj.x1, toobj.y1, toobj.x2, toobj.y2, fromobj.DrawtoPerc);
459
fromobj.DrawX2 = sidek.x;
460
fromobj.DrawY2 = sidek.y;
466
* Draws all kinds of objects, with local movement-offset (scrolling offset is handled with transforms??)
468
function drawobj(obji) {
469
var obj = Objects[obji];
470
var Sel = Selected[obji];
471
if(ContextObj == obji) {
476
context.strokeStyle = '#000';
477
context.lineWidth = 2.0;
478
// Compute coordinates including offset
479
if(obj.type == "Entity" || obj.type == "ERAttribute" || obj.type == "ERRel") {
484
rx = (x2 - x1) * 0.5;
485
ry = (y2 - y1) * 0.5;
487
if(obj.type == "Entity") {
489
drawrect(x1, y1, x2, y2, "#000");
490
if(obj.kind == "Weak") {
491
drawrect(x1 + 5, y1 + 5, x2 - 5, y2 - 5, "#000");
492
cliptext(x1 + 5, y1 + 5, x2 - 5, y2 - 5, obj.name, "20px Calibri", "center", 8, 6, "#000", 1, 0);
495
cliptext(x1, y1, x2, y2, obj.name, "20px Calibri", "center", 8, 6, "#000", 1, 0);
497
// Draw Select Marker
499
fourpoints(x1, y1 + ry, x2, y1 + ry, x1 + rx, y1, x1 + rx, y2, "#5f8");
501
} else if(obj.type == "ERAttribute") {
502
drawellipse(x1, y1, x2, y2);
503
if(obj.kind == "Key") {
504
cliptext(x1, y1, x2, y2, obj.name, "20px Calibri", "center", 8, 6, "#000", 2, 1);
506
cliptext(x1, y1, x2, y2, obj.name, "20px Calibri", "center", 8, 6, "#000", 2, 0);
508
if(obj.DrawtoID != "None") {
509
drawline(obj.DrawX1, obj.DrawY1, obj.DrawX2, obj.DrawY2, "#000", 2.0);
511
// Draw Select Marker
512
if(Cont && obj.DrawtoID == "None") {
513
fourpoints(x1, y1 + ry, x2, y1 + ry, x1 + rx, y1, x1 + rx, y2, "#fa2");
514
} else if(Sel || (Cont && obj.DrawtoID != "None")) {
515
fourpoints(x1, y1 + ry, x2, y1 + ry, x1 + rx, y1, x1 + rx, y2, "#5f8");
517
} else if(obj.type == "ERRel") {
518
if(obj.DrawtoID != "None") {
519
drawline(obj.DrawX1, obj.DrawY1, obj.DrawX2, obj.DrawY2, "#000", 2.0);
520
drawcardinality(obj.DrawX2, obj.DrawY2, obj.DrawtoSide, obj.DrawtoCard, obj.DrawtoXoffsCard, obj.DrawtoYoffsCard, "20px Calibri", 20, 1, "#0a0");
521
drawcardinality(obj.DrawX2, obj.DrawY2, obj.DrawtoSide, obj.DrawtoRole, obj.DrawtoXoffsRole, obj.DrawtoYoffsRole, "20px Calibri", 20, 2, "#0a0");
522
// function drawcardinality(x,y,side,tex,xoffs,yoffs,font,baseline,sign,color)
523
// if(i==5) obj = jQuery.parseJSON('{"type":"ERRel","id":"REL6","kind":"Strong","name":"FGFool","x1":460,"y1":160,"x2":520,"y2":220, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"0", "DrawtoCard":"N", "DrawtoRole":"Fumo", "DrawtoXoffsCard":"20", "DrawtoYoffsCard":"50","DrawtoXoffsRole":"20", "DrawtoYoffsRole":"-50", "DrawtoIDDest":"None", "DrawfromSideDest":"None","DrawtoSideDest":"None", "DrawtoPercDest":"0", "DrawtoDestCard":"1", "DrawtoDestRole":"Luma", "DrawtoDestXoffsCard":"0", "DrawtoDestYoffsCard":"-50","DrawtoDestXoffsRole":"0", "DrawtoDestYoffsRole":"-50", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":"","DrawX3":"", "DrawY3":"", "DrawX4":"","DrawY4":""}');
524
// if(i==6) obj = jQuery.parseJSON('{"type":"ERRel","id":"REL7","kind":"Weak","name":"PODrool","x1":360,"y1":360,"x2":420,"y2":420, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"0", "DrawtoCard":"1", "DrawtoRole":"Kumo", "DrawtoXoffsCard":"60", "DrawtoYoffsCard":"70", "DrawtoXoffsCard":"80", "DrawtoYoffsCard":"-70", "DrawtoIDDest":"None", "DrawfromSideDest":"None","DrawtoSideDest":"None", "DrawtoPercDest":"0", "DrawtoDestCard":"N", "DrawtoDestRole":"Zuuma", "DrawtoDestXoffsCard":"40", "DrawtoDestYoffsCard":"50", "DrawtoDestXoffsRole":"40", "DrawtoDestYoffsRole":"50", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":"","DrawX3":"", "DrawY3":"", "DrawX4":"","DrawY4":""}');
526
if(obj.DrawtoIDDest != "None") {
527
drawline(obj.DrawX3, obj.DrawY3, obj.DrawX4, obj.DrawY4, "#000", 2.0);
529
if(obj.kind == "Weak") {
530
drawdiamond(x1 - 4, y1 - 4, x2 + 4, y2 + 4);
531
drawdiamond(x1 + 4, y1 + 4, x2 - 4, y2 - 4);
532
cliptext(x1 + 8, y1 + 8, x2 - 8, y2 - 8, obj.name, "20px Calibri", "center", 8, 6, "#000", 3, 0);
534
drawdiamond(x1, y1, x2, y2, 0);
535
cliptext(x1, y1, x2, y2, obj.name, "20px Calibri", "center", 8, 6, "#000", 3, 0);
537
// Draw Select Markers
538
if(Sel || (Cont && obj.DrawtoID != "None" && obj.DrawtoIDDest != "None")) {
539
fourpoints(x1, y1 + ry, x2, y1 + ry, x1 + rx, y1, x1 + rx, y2, "#5f8");
541
if(obj.DrawfromSide != 1 && obj.DrawfromSideDest != 1) {
542
point(x1, y1 + ry, "#fa2");
544
if(obj.DrawfromSide != 2 && obj.DrawfromSideDest != 2) {
545
point(x1 + rx, y2, "#fa2");
547
if(obj.DrawfromSide != 3 && obj.DrawfromSideDest != 3) {
548
point(x2, y1 + ry, "#fa2");
550
if(obj.DrawfromSide != 4 && obj.DrawfromSideDest != 4) {
551
point(x1 + rx, y1, "#fa2");
562
context.clearRect(0, 0, 600, 600);
172
deltax = startx - gridx;
173
deltay = starty - gridy;
174
// We start drag mode
175
if((distance(gridx, gridy, startx, starty) > dragsensitivity) && clickstate == 1) {
178
// We are in drag mode
179
if(clickstate == 2) {
180
// Single Object Move - If Not Selected, Or if Selected and Center Area Is Dragged
181
if((downRes.typ == "Entity" || downRes.typ == "ERAttribute" || downRes.typ == "ERRel") && (downRes.code == "NonSel" || (downRes.code == "Cont" && downRes.side == "None") || (downRes.code == "ContDraw" && downRes.side == "None"))) {
184
// Single Object Scale Left
185
if((downRes.typ == "Entity" || downRes.typ == "ERAttribute") && (downRes.code == "Cont" && downRes.side == "1")) {
188
// Single Object Scale Bottom
189
if((downRes.typ == "Entity" || downRes.typ == "ERAttribute") && (downRes.code == "Cont" && downRes.side == "2")) {
192
// Single Object Scale Right
193
if((downRes.typ == "Entity" || downRes.typ == "ERAttribute") && (downRes.code == "Cont" && downRes.side == "3")) {
196
// Single Object Scale Top
197
if((downRes.typ == "Entity" || downRes.typ == "ERAttribute") && (downRes.code == "Cont" && downRes.side == "4")) {
200
if(downRes.typ == "ERAttribute" && downRes.code == "ContDraw" && downRes.side != "None") {
201
clickstate=8; // Attribute Connection Draw
202
drawlinekind=1; // Tell drawing engine to draw attribute line symbol
203
if(downRes.side == "1") {
204
drawlinesx = downRes.x1; // Initiate start parameters for line drawing left side
205
drawlinesy = downRes.y1 + ((downRes.y2 - downRes.y1) * 0.5);
206
} else if(downRes.side == "2") {
207
drawlinesx = downRes.x1 + ((downRes.x2 - downRes.x1) * 0.5); // Initiate start parameters for line drawing bottom side
208
drawlinesy = downRes.y2;
209
} else if(downRes.side == "3") {
210
drawlinesx = downRes.x2; // Initiate start parameters for line drawing left side
211
drawlinesy = downRes.y1 + ((downRes.y2 - downRes.y1) * 0.5);
212
} else if(downRes.side == "4") {
213
drawlinesx = downRes.x1 + ((downRes.x2 - downRes.x1) * 0.5); // Initiate start parameters for line drawing bottom side
214
drawlinesy = downRes.y1;
216
drawlinedx = drawlinesx;
217
drawlinedy = drawlinesy;
219
if(downRes.typ == "ERRel" && downRes.code == "ContDraw" && downRes.side != "None") {
220
var obj=Objects[downRes.objid];
221
if(downRes.side != obj.DrawfromSide && downRes.side != obj.DrawfromSideDest) {
222
clickstate = 9; // Attribute Connection Draw
223
drawlinekind = 1; // Tell drawing engine to draw relation line symbol
224
if(downRes.side == "1") {
225
drawlinesx = downRes.x1; // Initiate start parameters for line drawing left side
226
drawlinesy = downRes.y1 + ((downRes.y2 - downRes.y1) * 0.5);
227
} else if(downRes.side == "2") {
228
drawlinesx = downRes.x1 + ((downRes.x2 - downRes.x1) * 0.5); // Initiate start parameters for line drawing bottom side
229
drawlinesy = downRes.y2;
230
} else if(downRes.side == "3") {
231
drawlinesx = downRes.x2; // Initiate start parameters for line drawing left side
232
drawlinesy = downRes.y1 + ((downRes.y2 - downRes.y1) * 0.5);
233
} else if(downRes.side == "4") {
234
drawlinesx = downRes.x1 + ((downRes.x2 - downRes.x1) * 0.5); // Initiate start parameters for line drawing bottom side
235
drawlinesy = downRes.y1;
237
drawlinedx = drawlinesx;
238
drawlinedy = drawlinesy;
243
var obj = Objects[downRes.objid];
245
if(clickstate == 3) { // We are in single rectangular object move
246
obj.x1 = downRes.x1 - deltax;
247
obj.y1 = downRes.y1 - deltay;
248
obj.x2 = downRes.x2 - deltax;
249
obj.y2 = downRes.y2 - deltay;
250
} else if(clickstate == 4) { // We are in single rectangular object scale left
251
if((obj.x2 - downRes.x1 + deltax) > 60) obj.x1 = downRes.x1 - deltax;
252
} else if(clickstate == 5) { // We are in single rectangular object scale bottom
253
if((downRes.y2 - obj.y1 - deltay) > 40) obj.y2 = downRes.y2 - deltay;
254
} else if(clickstate==6) { // We are in single rectangular object scale right
255
if((downRes.x2 - obj.x1 - deltax) > 60) obj.x2 = downRes.x2 - deltax;
256
} else if(clickstate == 7) { // We are in single rectangular object scale top
257
if((obj.y2 - downRes.y1 + deltay) > 40) obj.y1 = downRes.y1 - deltay;
258
} else if(clickstate == 8 || clickstate == 9) { // We are in straight connective line drawing mode
265
* Call-forward for mouse-over event
267
function mouseover(x, y) {
268
// Code of touch, and if available object id and id of side of object that was touched
269
// Tolerances included as constant
270
var obj_code = "None";
272
var obj_sidentifier =" None";
273
var obj_sideperc = 0;
274
var obj_centerdist = 0;
275
var obj_type = "None";
283
for(j = 0; j < Identifiers.length; j++) {
284
var objid = Identifiers[j];
285
var obj = Objects[objid];
286
var Sel = Selected[objid];
287
if(ContextObj == objid) {
292
// Compute coordinates including offset
293
if(obj.type == "Entity" || obj.type == "ERAttribute" || obj.type == "ERRel") {
298
rx = (x2 - x1) * 0.5;
299
ry = (y2 - y1) * 0.5;
302
// For each kind of clickable object, check if we are inside object and if so assign variables
303
// Any general properties for all object types are set when "found" is true
304
if(obj.type == "Entity") {
305
if(x > (x1 - sidetol) && y > (y1 - sidetol ) && x < (x2 + sidetol) && y < (y2 + sidetol)) {
313
side = computeside(x, y, x1, y1, x2, y2, sidetol);
314
obj_sidentifier = side.side;
315
obj_sideperc = side.perc;
316
obj_centerdist = side.dist;
319
} else if(obj.type=="ERAttribute") {
320
if(x > (x1 - sidetol) && y > (y1 - sidetol) && x < (x2 + sidetol) && y < (y2 + sidetol)) {
326
if(obj.DrawtoID == "None") {
327
obj_code = "ContDraw";
332
side = computeside(x, y, x1, y1, x2, y2, sidetol);
333
obj_sidentifier = side.side;
334
obj_sideperc = side.perc;
335
obj_centerdist = side.dist;
338
} else if(obj.type == "ERRel") {
339
if(x > (x1 - sidetol) && y > (y1 - sidetol) && x < (x2 + sidetol) && y < (y2 + sidetol)) {
341
// Colision detection against diamond
344
if(y > (y1 + ry - xk - sidetol) && y < (y1 + ry + xk + sidetol)) {
348
if(y > (y1 - rx + xk - sidetol) && y < ( y2 + rx - xk + sidetol)) {
353
if((x > (x1 - sidetol)) && (x < (x1 + sidetol)) && (y > (y1 + ry - sidetol)) && (y < (y1 + ry + sidetol))) {
356
if((x > (x1 + rx - sidetol)) && (x < (x1 + rx + sidetol)) && (y > (y2 - sidetol)) && (y < (y2 + sidetol))) {
359
if((x > (x2 - sidetol)) && (x < (x2 + sidetol)) && (y > (y1 + ry - sidetol)) && (y < (y1 + ry + sidetol))) {
362
if((x > (x1 + rx - sidetol)) && (x < (x1 + rx + sidetol)) && (y > (y1 - sidetol)) && (y < (y1 + sidetol))) {
370
if(obj.DrawtoID == "None"){
371
obj_code = "ContDraw";
372
} else if(obj.DrawtoIDDest == "None") {
373
obj_code = "ContDraw";
384
// Save coordinates at time of click
391
printstr=obj_id + " " + obj_sidentifier + " " + obj_sideperc;
397
side:obj_sidentifier,
398
sideperc:obj_sideperc,
399
centerdist:obj_centerdist,
409
* Turns JSON data into jQuery objects
411
function importdata() {
412
for(i = 0; i < 7; i++) {
414
obj = jQuery.parseJSON('{"type":"ERAttribute","id":"ATT1","kind":"Multiple","name":"Addressfosoppooo","x1":220,"y1":100,"x2":300,"y2":140, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"None", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":""}');
417
obj = jQuery.parseJSON('{"type":"Entity","id":"ENT2","kind":"Weak","name":"Carsmashoepppoloo","x1":100,"y1":160,"x2":220,"y2":220}');
420
obj = jQuery.parseJSON('{"type":"ERAttribute","id":"ATT3","kind":"Key","name":"SSNFooomesPoo","x1":160,"y1":260,"x2":260,"y2":300, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"None", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":""}');
423
obj = jQuery.parseJSON('{"type":"Entity","id":"ENT4","kind":"Strong","name":"Trailerfpdddpeoooooe","x1":320,"y1":260,"x2":420,"y2":320}');
426
obj = jQuery.parseJSON('{"type":"Entity","id":"ENT5","kind":"Strong","name":"Grail","x1":120,"y1":440,"x2":220,"y2":480}');
429
obj = jQuery.parseJSON('{"type":"ERRel","id":"REL6","kind":"Strong","name":"FGFool","x1":460,"y1":160,"x2":520,"y2":220, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"0", "DrawtoCard":"N", "DrawtoRole":"Fumo", "DrawtoXoffs":"20", "DrawtoYoffs":"50", "DrawtoIDDest":"None", "DrawfromSideDest":"None","DrawtoSideDest":"None", "DrawtoPercDest":"0", "DrawtoDestCard":"N", "DrawtoDestRole":"Luma", "DrawtoDestXoffs":"0", "DrawtoDestYoffs":"-50", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":"","DrawX3":"", "DrawY3":"", "DrawX4":"","DrawY4":""}');
432
obj = jQuery.parseJSON('{"type":"ERRel","id":"REL7","kind":"Weak","name":"PODrool","x1":360,"y1":360,"x2":420,"y2":420, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"0", "DrawtoCard":"N", "DrawtoRole":"Kumo", "DrawtoXoffs":"60", "DrawtoYoffs":"70", "DrawtoIDDest":"None", "DrawfromSideDest":"None","DrawtoSideDest":"None", "DrawtoPercDest":"0", "DrawtoDestCard":"N", "DrawtoDestRole":"Zuuma", "DrawtoDestXoffs":"40", "DrawtoDestYoffs":"50", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":"","DrawX3":"", "DrawY3":"", "DrawX4":"","DrawY4":""}');
435
Objects[objid] = obj;
436
Identifiers.push(objid);
442
* Prepares all kinds of objects, with local movement-offset (scrolling offset is handled with transforms??)
443
* Ofss in prepare are not finished.
445
function prepareobj(obji) {
446
var fromobj = Objects[obji];
447
// Attributes are prepared by re-pointing the DrawX1, DrawY1, DrawX2 and DrawY2 variables and Relationships are prepared by re-pointing DrawX1-DrawX4 and DrawY1-DrawY4
448
if((fromobj.type == "ERAttribute" || fromobj.type == "ERRel") && fromobj.DrawtoID != "None") {
449
var toid = fromobj.DrawtoID;
450
var toobj = Objects[toid];
452
if(fromobj.DrawtoIDDest != "None" && fromobj.DrawtoIDDest != undefined) {
453
var toiddest = fromobj.DrawtoIDDest;
454
var toobjdest = Objects[toiddest];
455
sidek = makeside(fromobj.DrawfromSideDest, fromobj.x1, fromobj.y1, fromobj.x2, fromobj.y2, 0.5);
456
fromobj.DrawX3 = sidek.x;
457
fromobj.DrawY3 = sidek.y;
458
sidek = makeside(fromobj.DrawtoSideDest, toobjdest.x1, toobjdest.y1, toobjdest.x2, toobjdest.y2, fromobj.DrawtoPercDest);
459
fromobj.DrawX4 = sidek.x;
460
fromobj.DrawY4 = sidek.y;
462
//printstr=fromobj.DrawfromSide+" "+fromobj.x1+" "+fromobj.y1+" "+fromobj.x2+" "+fromobj.y2+" :: "+fromobj.DrawtoSide+" "+toobj.x1+" "+toobj.y1+" "+toobj.x2+" "+toobj.y2+" "+fromobj.DrawtoPerc;
463
sidek = makeside(fromobj.DrawfromSide, fromobj.x1, fromobj.y1, fromobj.x2, fromobj.y2, 0.5);
464
fromobj.DrawX1 = sidek.x;
465
fromobj.DrawY1 = sidek.y;
466
sidek = makeside(fromobj.DrawtoSide, toobj.x1, toobj.y1, toobj.x2, toobj.y2, fromobj.DrawtoPerc);
467
fromobj.DrawX2 = sidek.x;
468
fromobj.DrawY2 = sidek.y;
474
* Draws all kinds of objects, with local movement-offset (scrolling offset is handled with transforms??)
476
function drawobj(obji) {
477
var obj = Objects[obji];
478
var Sel = Selected[obji];
479
if(ContextObj == obji) {
484
context.strokeStyle = '#000';
485
context.lineWidth = 2.0;
486
// Compute coordinates including offset
487
if(obj.type == "Entity" || obj.type == "ERAttribute" || obj.type == "ERRel") {
492
rx = (x2 - x1) * 0.5;
493
ry = (y2 - y1) * 0.5;
495
if(obj.type == "Entity") {
497
drawrect(x1, y1, x2, y2, "#000");
498
if(obj.kind == "Weak") {
499
drawrect(x1 + 5, y1 + 5, x2 - 5, y2 - 5, "#000");
500
cliptext(x1 + 5, y1 + 5, x2 - 5, y2 - 5, obj.name, "20px Calibri", "center", 8, 6, "#000", 1, 0);
503
cliptext(x1, y1, x2, y2, obj.name, "20px Calibri", "center", 8, 6, "#000", 1, 0);
505
// Draw Select Marker
507
fourpoints(x1, y1 + ry, x2, y1 + ry, x1 + rx, y1, x1 + rx, y2, "#5f8");
509
} else if(obj.type == "ERAttribute") {
510
drawellipse(x1, y1, x2, y2);
511
if(obj.kind == "Key") {
512
cliptext(x1, y1, x2, y2, obj.name, "20px Calibri", "center", 8, 6, "#000", 2, 1);
514
cliptext(x1, y1, x2, y2, obj.name, "20px Calibri", "center", 8, 6, "#000", 2, 0);
516
if(obj.DrawtoID != "None") {
517
drawline(obj.DrawX1, obj.DrawY1, obj.DrawX2, obj.DrawY2, "#000", 2.0);
519
// Draw Select Marker
520
if(Cont && obj.DrawtoID == "None") {
521
fourpoints(x1, y1 + ry, x2, y1 + ry, x1 + rx, y1, x1 + rx, y2, "#fa2");
522
} else if(Sel || (Cont && obj.DrawtoID != "None")) {
523
fourpoints(x1, y1 + ry, x2, y1 + ry, x1 + rx, y1, x1 + rx, y2, "#5f8");
525
} else if(obj.type == "ERRel") {
526
if(obj.DrawtoID != "None") {
527
drawline(obj.DrawX1, obj.DrawY1, obj.DrawX2, obj.DrawY2, "#000", 2.0);
528
drawcardinality(obj.DrawX2, obj.DrawY2, obj.DrawtoSide, obj.DrawtoCard, obj.DrawtoXoffsCard, obj.DrawtoYoffsCard, "20px Calibri", 20, 1, "#0a0");
529
drawcardinality(obj.DrawX2, obj.DrawY2, obj.DrawtoSide, obj.DrawtoRole, obj.DrawtoXoffsRole, obj.DrawtoYoffsRole, "20px Calibri", 20, 2, "#0a0");
530
//function drawcardinality(x,y,side,tex,xoffs,yoffs,font,baseline,sign,color)
531
//if(i==5) obj = jQuery.parseJSON('{"type":"ERRel","id":"REL6","kind":"Strong","name":"FGFool","x1":460,"y1":160,"x2":520,"y2":220, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"0", "DrawtoCard":"N", "DrawtoRole":"Fumo", "DrawtoXoffsCard":"20", "DrawtoYoffsCard":"50","DrawtoXoffsRole":"20", "DrawtoYoffsRole":"-50", "DrawtoIDDest":"None", "DrawfromSideDest":"None","DrawtoSideDest":"None", "DrawtoPercDest":"0", "DrawtoDestCard":"1", "DrawtoDestRole":"Luma", "DrawtoDestXoffsCard":"0", "DrawtoDestYoffsCard":"-50","DrawtoDestXoffsRole":"0", "DrawtoDestYoffsRole":"-50", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":"","DrawX3":"", "DrawY3":"", "DrawX4":"","DrawY4":""}');
532
//if(i==6) obj = jQuery.parseJSON('{"type":"ERRel","id":"REL7","kind":"Weak","name":"PODrool","x1":360,"y1":360,"x2":420,"y2":420, "DrawtoID":"None", "DrawfromSide":"None","DrawtoSide":"None", "DrawtoPerc":"0", "DrawtoCard":"1", "DrawtoRole":"Kumo", "DrawtoXoffsCard":"60", "DrawtoYoffsCard":"70", "DrawtoXoffsCard":"80", "DrawtoYoffsCard":"-70", "DrawtoIDDest":"None", "DrawfromSideDest":"None","DrawtoSideDest":"None", "DrawtoPercDest":"0", "DrawtoDestCard":"N", "DrawtoDestRole":"Zuuma", "DrawtoDestXoffsCard":"40", "DrawtoDestYoffsCard":"50", "DrawtoDestXoffsRole":"40", "DrawtoDestYoffsRole":"50", "DrawX1":"", "DrawY1":"", "DrawX2":"","DrawY2":"","DrawX3":"", "DrawY3":"", "DrawX4":"","DrawY4":""}');
534
if(obj.DrawtoIDDest != "None") {
535
drawline(obj.DrawX3, obj.DrawY3, obj.DrawX4, obj.DrawY4, "#000", 2.0);
537
if(obj.kind == "Weak") {
538
drawdiamond(x1 - 4, y1 - 4, x2 + 4, y2 + 4);
539
drawdiamond(x1 + 4, y1 + 4, x2 - 4, y2 - 4);
540
cliptext(x1 + 8, y1 + 8, x2 - 8, y2 - 8, obj.name, "20px Calibri", "center", 8, 6, "#000", 3, 0);
542
drawdiamond(x1, y1, x2, y2, 0);
543
cliptext(x1, y1, x2, y2, obj.name, "20px Calibri", "center", 8, 6, "#000", 3, 0);
545
// Draw Select Markers
546
if(Sel || (Cont && obj.DrawtoID != "None" && obj.DrawtoIDDest != "None")) {
547
fourpoints(x1, y1 + ry, x2, y1 + ry, x1 + rx, y1, x1 + rx, y2, "#5f8");
549
if(obj.DrawfromSide != 1 && obj.DrawfromSideDest != 1) {
550
point(x1, y1 + ry, "#fa2");
552
if(obj.DrawfromSide != 2 && obj.DrawfromSideDest != 2) {
553
point(x1 + rx, y2, "#fa2");
555
if(obj.DrawfromSide != 3 && obj.DrawfromSideDest != 3) {
556
point(x2, y1 + ry, "#fa2");
558
if(obj.DrawfromSide != 4 && obj.DrawfromSideDest != 4) {
559
point(x1 + rx, y1, "#fa2");
570
context.clearRect(0, 0, 600, 600);
563
571
// overline(gridx,gridy,150,550,550,300,8.0);
565
context.strokeStyle = '#ddd';
566
context.lineWidth = 0.5;
568
for(i = 0; i < 600; i += 20) {
569
context.moveTo(i, 0);
570
context.lineTo(i, 600);
571
context.moveTo(0, i);
572
context.lineTo(600, i);
576
if(drawlinekind == 1) {
577
drawline(drawlinesx, drawlinesy, drawlinedx, drawlinedy, "#000", 1.0);
579
// Prepare model objects
580
for(i = 0; i < Identifiers.length; i++){
581
var objid = Identifiers[i];
584
// Draw model objects
585
for(i = 0; i < Identifiers.length; i++){
586
var objid = Identifiers[i];
591
context.strokeStyle = '#444';
592
context.lineWidth = 1.0;
593
context.moveTo(gridx - gridsize, gridy);
594
context.lineTo(gridx + gridsize, gridy);
595
context.moveTo(gridx, gridy - gridsize);
596
context.lineTo(gridx, gridy + gridsize);
598
context.strokeStyle = '#ddd';
599
context.fillStyle = '#000';
600
context.font = "bold 16px Arial";
601
context.textAlign = "left";
602
context.fillText("currop: " + printstr, 20, 576);
603
setTimeout("foo();", 100);
b'\\ No newline at end of file'
573
context.strokeStyle = '#ddd';
574
context.lineWidth = 0.5;
576
for(i = 0; i < 600; i += 20) {
577
context.moveTo(i, 0);
578
context.lineTo(i, 600);
579
context.moveTo(0, i);
580
context.lineTo(600, i);
584
if(drawlinekind == 1) {
585
drawline(drawlinesx, drawlinesy, drawlinedx, drawlinedy, "#000", 1.0);
587
// Prepare model objects
588
for(i = 0; i < Identifiers.length; i++){
589
var objid = Identifiers[i];
592
// Draw model objects
593
for(i = 0; i < Identifiers.length; i++){
594
var objid = Identifiers[i];
599
context.strokeStyle = '#444';
600
context.lineWidth = 1.0;
601
context.moveTo(gridx - gridsize, gridy);
602
context.lineTo(gridx + gridsize, gridy);
603
context.moveTo(gridx, gridy - gridsize);
604
context.lineTo(gridx, gridy + gridsize);
606
context.strokeStyle = '#ddd';
607
context.fillStyle = '#000';
608
context.font = "bold 16px Arial";
609
context.textAlign = "left";
610
context.fillText("currop: " + printstr, 20, 576);
611
setTimeout("foo();", 100);
b'\\ No newline at end of file'