kapstok / NHL-DePa2 (public) (License: Unspecified) (since 2018-11-09) (hash sha1)
Design Patterns school project; a GUI using multiple Design Patterns.
List of commits:
Subject Hash Author Date (UTC)
Save nested Entities with Ornaments properly. 645cf4ae287fd2511b4c1404d0d9559372e5e10b Jan Allersma 2018-11-08 12:04:40
Fix bug: activate group after movement with cloning. 482c53ecab43cdee03590949669c22227d104475 Jan Allersma 2018-11-08 10:35:27
Include Groups in Commands, removing dp.groups.groups. 699f767ac316edd481630a943f7a1884c5bc16f2 Jan Allersma 2018-11-07 11:27:15
Fix ability to nest in Groups. fd546a42ef54bdf5d2966eb7facbbf21a6b72e1b Jan Allersma 2018-11-06 17:49:11
Fix file I/O for single entities. 093b7d31a215067212927b1d92bdbbee306ea345 Jan Allersma 2018-11-06 16:49:55
Fix file I/O issue. 25c0b40db223c806eb3ea8bd28238dedc38ca8b5 Jan Allersma 2018-11-02 16:22:59
Cleanup commenting. 445aea4a5115c9110a097bfc7ac9f7d5ad48a9e7 Jan Allersma 2018-11-02 14:33:08
Show Ornaments on Canvas. d8456f15d69550c4cb0aa615cccb96b45a77f6a6 Jan Allersma 2018-11-02 14:08:47
Support Entities for Create & Destruct commands. cc900579eedf9c6288ce1c1883122856794e05a0 Jan Allersma 2018-11-02 13:25:43
Use entities instead of shapes when constructing ornaments. 13f08847624489f60a37db55c2aedbba6b021f98 Jan Allersma 2018-11-01 17:02:47
Remove obsolete 'calcBounds' function. 475ec330736b5800d12d091415480b163dd244e2 Jan Allersma 2018-11-01 14:28:29
Setup for decorator pattern. 762914dec31b1fb1d4cf6bb0cef2e148010652a4 Jan Allersma 2018-11-01 14:12:51
Revert commit '5678eb6'. 6225242719b2cfc5ee0de9f8d05edbc7a69007a7 Jan Allersma 2018-11-01 14:10:27
Make groups movable and resizable. 1ca7c18ab103a8d1055b27f63192038fd75aef3e Jan Allersma 2018-10-17 14:51:32
Use translations instead of positions for moving shapes. 9551c7d2608f01c3950743fd97bd217aab8f5766 Jan Allersma 2018-10-16 16:11:03
Implement Visitor pattern for Groups. bd30477ce616362d3f58cef072d1ebc78077fa85 Jan Allersma 2018-10-16 13:28:37
Implement Visitor pattern for Shapes. e52412c3059c1ee5fa9abdf4a32db0f47981eee1 Jan Allersma 2018-10-16 12:43:17
Setup 'Decorator' and 'Ornament' class. 5678eb6257bcf88502078d08395a394a1c24568b Jan Allersma 2018-10-09 09:29:50
Use different strats instead of seperate Shapes. a56e1e665a0292d15139eddfd8ebdeb8c95251b4 Jan Allersma 2018-10-01 11:37:45
Make ornament interface compatible with Entities. 21383d5f200a338f8255d7d33b6989937c19fed6 Jan Allersma 2018-10-08 20:36:23
Commit 645cf4ae287fd2511b4c1404d0d9559372e5e10b - Save nested Entities with Ornaments properly.
Author: Jan Allersma
Author date (UTC): 2018-11-08 12:04
Committer name: Jan Allersma
Committer date (UTC): 2018-11-08 12:33
Parent(s): 482c53ecab43cdee03590949669c22227d104475
Signing key:
Tree: dca1d889f5499cf756494a26de12eb195e308a20
File Lines added Lines deleted
README.md 2 1
source/commands/create.d 2 1
source/entities/entity.d 2 0
source/entities/group.d 1 10
source/entities/ornament.d 2 0
source/file.d 6 3
source/vistors/saveVisitor.d 13 0
File README.md changed (mode: 100644) (index 20dd717..c4d15d1)
... ... variable.
47 47 - Grafische indicatie van een groep. De groepen worden wel goed weergegeven, - Grafische indicatie van een groep. De groepen worden wel goed weergegeven,
48 48 maar subgroepen niet. maar subgroepen niet.
49 49
50 - Groups worden nog niet goed geladen: ze verliezen hun kleurtje.
50 - Een `SaveVisitor` voor `Ornament` kan controleren `if(o.ornament !is null)`.
51 Zo ja, move `o.ornament` een beetje?
51 52
52 53 - Kan een `Global.Brush.clone` niet gewoon een Entity zijn? Dan hoef je - Kan een `Global.Brush.clone` niet gewoon een Entity zijn? Dan hoef je
53 54 denk ik niet `Global.Brush.cloneGroup` te gebruiken. denk ik niet `Global.Brush.cloneGroup` te gebruiken.
File source/commands/create.d changed (mode: 100644) (index e5a298a..55a2843)
... ... public class CreateCmd : Command {
30 30 e.checkBounds(x,y); e.checkBounds(x,y);
31 31 } }
32 32
33 // Should be done by Visitor self.
34 33 public override void save(Savefile file) { public override void save(Savefile file) {
34 if(e.type() == "ornament") return;
35
35 36 if(e.group is null) if(e.group is null)
36 37 e.accept(new SaveVisitor(file)); e.accept(new SaveVisitor(file));
37 38 } }
File source/entities/entity.d changed (mode: 100644) (index c3e92a5..dfc215f)
... ... module dp.ent.entity;
3 3 public import dp.visitor.visitor; public import dp.visitor.visitor;
4 4 public import dp.ent.group; public import dp.ent.group;
5 5
6 import dp.ent.ornament;
6 7 import dp.ent.shape; import dp.ent.shape;
7 8
8 9 class Entity { class Entity {
9 10 public bool active = true; public bool active = true;
10 11 public Group group = null; public Group group = null;
12 public Ornament ornament = null;
11 13
12 14 @property @property
13 15 public abstract double size(); public abstract double size();
File source/entities/group.d changed (mode: 100644) (index f0a3e18..da8d285)
... ... class Group : Entity {
70 70
71 71 @property @property
72 72 public override string to_string() { public override string to_string() {
73 string result = type ~ " " ~ to!string(length) ~ "\n";
74
75 foreach(e; entities) {
76 if(e.active) {
77 result ~= "\t";
78 result ~= e.to_string();
79 }
80 }
81
82 return result;
73 return type ~ " " ~ to!string(length) ~ "\n";
83 74 } }
84 75
85 76 public override void accept(Visitor v) { public override void accept(Visitor v) {
File source/entities/ornament.d changed (mode: 100644) (index 08bc9a6..cf58703)
... ... class Ornament : Entity {
14 14 this.alignment = alignment; this.alignment = alignment;
15 15 this.value = value; this.value = value;
16 16 this.context = context; this.context = context;
17 this.group = entity.group; // Redundant?
18 entity.ornament = this;
17 19
18 20 context.setSourceRgba(0.5,0.5,0.5,1); context.setSourceRgba(0.5,0.5,0.5,1);
19 21 context.selectFontFace("Purisa", CairoFontSlant.NORMAL, CairoFontWeight.BOLD); context.selectFontFace("Purisa", CairoFontSlant.NORMAL, CairoFontWeight.BOLD);
File source/file.d changed (mode: 100644) (index e2c5d9a..a46635f)
... ... import dp.command.load;
16 16 import Global = dp.global; import Global = dp.global;
17 17
18 18 public class Savefile { public class Savefile {
19 public int indent;
19 20 private string filename; private string filename;
20 21 private string content; private string content;
21 22
22 23 this(string filename) { this(string filename) {
23 24 content = ""; content = "";
25 indent = 0;
24 26 this.filename = filename; this.filename = filename;
25 27 } }
26 28
27 29 public void toFile(Entity entity) { public void toFile(Entity entity) {
28 write("E(" ~ entity.to_string() ~ "): ");
29 30 if(entity.active) { if(entity.active) {
30 writeln("Active");
31 for(int i = 0; i < indent; i++)
32 content ~= "\t";
33
31 34 content ~= entity.to_string(); content ~= entity.to_string();
32 } else writeln("Inactive");
35 }
33 36 } }
34 37
35 38 public void load() { public void load() {
File source/vistors/saveVisitor.d changed (mode: 100644) (index 5501494..6a038c8)
... ... public class SaveVisitor : Visitor {
12 12
13 13 public override void visit(Shape s) { public override void visit(Shape s) {
14 14 f.toFile(s); f.toFile(s);
15
16 if(s.ornament !is null)
17 s.ornament.accept(new SaveVisitor(f));
15 18 } }
16 19
17 20 public override void visit(Group g) { public override void visit(Group g) {
18 21 f.toFile(g); f.toFile(g);
22
23 f.indent++;
24
25 for(size_t i = 0; i < g.length; i++)
26 g.get(i).accept(new SaveVisitor(f));
27
28 f.indent--;
29
30 if(g.ornament !is null)
31 g.ornament.accept(new SaveVisitor(f));
19 32 } }
20 33
21 34 public override void visit(Ornament o) { public override void visit(Ornament o) {
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/kapstok/NHL-DePa2

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/kapstok/NHL-DePa2

Clone this repository using git:
git clone git://git.rocketgit.com/user/kapstok/NHL-DePa2

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main