From 5326fcf2857f3562b9261c743d181c6c221ea81c Mon Sep 17 00:00:00 2001
From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr>
Date: Tue, 5 Jan 2021 15:24:41 +0100
Subject: [PATCH] Adding aggregation in CD

---
 modeling/AVATAR/AirbusDoor_V2.xml             | 140 ++++++-------
 src/main/java/ui/ActionPerformer.java         |   2 +
 src/main/java/ui/TGComponentManager.java      |   7 +
 src/main/java/ui/TGUIAction.java              |   5 +-
 .../AvatarCDAggregationConnector.java         | 188 ++++++++++++++++++
 src/main/java/ui/avatarcd/AvatarCDBlock.java  |   2 +-
 .../ui/avatarcd/AvatarCDConnectingPoint.java  |   3 +
 .../java/ui/avatarcd/AvatarCDToolBar.java     |   6 +-
 src/main/java/ui/util/IconManager.java        |   4 +-
 src/main/resources/ui/util/avatarbdaggre.gif  | Bin 0 -> 113 bytes
 10 files changed, 283 insertions(+), 74 deletions(-)
 create mode 100644 src/main/java/ui/avatarcd/AvatarCDAggregationConnector.java
 create mode 100644 src/main/resources/ui/util/avatarbdaggre.gif

diff --git a/modeling/AVATAR/AirbusDoor_V2.xml b/modeling/AVATAR/AirbusDoor_V2.xml
index 3abd60d8f9..d22f13741c 100644
--- a/modeling/AVATAR/AirbusDoor_V2.xml
+++ b/modeling/AVATAR/AirbusDoor_V2.xml
@@ -1891,7 +1891,7 @@
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector" value="" />
 <TGConnectingPoint num="0" id="1198" />
-<P1  x="757" y="349" id="1455" />
+<P1  x="757" y="349" id="1480" />
 <P2  x="715" y="303" id="1354" />
 <AutomaticDrawing  data="true" />
 <extraparam>
@@ -1906,7 +1906,7 @@
 <infoparam name="connector" value="" />
 <TGConnectingPoint num="0" id="1200" />
 <P1  x="715" y="205" id="1361" />
-<P2  x="757" y="134" id="1480" />
+<P2  x="757" y="134" id="1455" />
 <AutomaticDrawing  data="true" />
 <extraparam>
 <isd value="in lock()" />
@@ -2042,11 +2042,11 @@ in DoorAndLockButton
 </COMPONENT>
 <SUBCOMPONENT type="5000" id="1249" >
 <father id="1374" num="0" />
-<cdparam x="71" y="280" />
-<sizeparam width="225" height="98" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="558" y="184" />
+<sizeparam width="136" height="190" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="438" minY="0" maxY="292" />
-<infoparam name="Block0" value="Captain" />
+<cdrectangleparam minX="0" maxX="527" minY="0" maxY="200" />
+<infoparam name="Block0" value="KeyboardFailure" />
 <TGConnectingPoint num="0" id="1225" />
 <TGConnectingPoint num="1" id="1226" />
 <TGConnectingPoint num="2" id="1227" />
@@ -2074,18 +2074,16 @@ in DoorAndLockButton
 <extraparam>
 <blockType data="block" color="-4072719" />
 <CryptoBlock value="false" />
-<Attribute access="0" id="isInCockpit" value="true" type="4" typeOther="" />
-<Attribute access="0" id="knowsEmergencyCode" value="true" type="4" typeOther="" />
-<Attribute access="0" id="code" value="" type="5" typeOther="Code" />
+<Attribute access="0" id="codeValue" value="1" type="8" typeOther="" />
 </extraparam>
 </SUBCOMPONENT>
 <SUBCOMPONENT type="5000" id="1274" >
 <father id="1374" num="1" />
-<cdparam x="71" y="386" />
-<sizeparam width="225" height="98" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="319" y="175" />
+<sizeparam width="217" height="98" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="438" minY="0" maxY="292" />
-<infoparam name="Block0" value="FirstOfficer" />
+<cdrectangleparam minX="0" maxX="446" minY="0" maxY="292" />
+<infoparam name="Block0" value="Passenger" />
 <TGConnectingPoint num="0" id="1250" />
 <TGConnectingPoint num="1" id="1251" />
 <TGConnectingPoint num="2" id="1252" />
@@ -2113,8 +2111,8 @@ in DoorAndLockButton
 <extraparam>
 <blockType data="block" color="-4072719" />
 <CryptoBlock value="false" />
-<Attribute access="0" id="isInCockpit" value="true" type="4" typeOther="" />
-<Attribute access="0" id="knowsEmergencyCode" value="true" type="4" typeOther="" />
+<Attribute access="0" id="isInCockpit" value="false" type="4" typeOther="" />
+<Attribute access="0" id="knowsEmergencyCode" value="false" type="4" typeOther="" />
 <Attribute access="0" id="code" value="" type="5" typeOther="Code" />
 </extraparam>
 </SUBCOMPONENT>
@@ -2159,11 +2157,11 @@ in DoorAndLockButton
 </SUBCOMPONENT>
 <SUBCOMPONENT type="5000" id="1324" >
 <father id="1374" num="3" />
-<cdparam x="319" y="175" />
-<sizeparam width="217" height="98" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="71" y="386" />
+<sizeparam width="225" height="98" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="446" minY="0" maxY="292" />
-<infoparam name="Block0" value="Passenger" />
+<cdrectangleparam minX="0" maxX="438" minY="0" maxY="292" />
+<infoparam name="Block0" value="FirstOfficer" />
 <TGConnectingPoint num="0" id="1300" />
 <TGConnectingPoint num="1" id="1301" />
 <TGConnectingPoint num="2" id="1302" />
@@ -2191,18 +2189,18 @@ in DoorAndLockButton
 <extraparam>
 <blockType data="block" color="-4072719" />
 <CryptoBlock value="false" />
-<Attribute access="0" id="isInCockpit" value="false" type="4" typeOther="" />
-<Attribute access="0" id="knowsEmergencyCode" value="false" type="4" typeOther="" />
+<Attribute access="0" id="isInCockpit" value="true" type="4" typeOther="" />
+<Attribute access="0" id="knowsEmergencyCode" value="true" type="4" typeOther="" />
 <Attribute access="0" id="code" value="" type="5" typeOther="Code" />
 </extraparam>
 </SUBCOMPONENT>
 <SUBCOMPONENT type="5000" id="1349" >
 <father id="1374" num="4" />
-<cdparam x="558" y="184" />
-<sizeparam width="136" height="190" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="71" y="280" />
+<sizeparam width="225" height="98" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="527" minY="0" maxY="200" />
-<infoparam name="Block0" value="KeyboardFailure" />
+<cdrectangleparam minX="0" maxX="438" minY="0" maxY="292" />
+<infoparam name="Block0" value="Captain" />
 <TGConnectingPoint num="0" id="1325" />
 <TGConnectingPoint num="1" id="1326" />
 <TGConnectingPoint num="2" id="1327" />
@@ -2230,7 +2228,9 @@ in DoorAndLockButton
 <extraparam>
 <blockType data="block" color="-4072719" />
 <CryptoBlock value="false" />
-<Attribute access="0" id="codeValue" value="1" type="8" typeOther="" />
+<Attribute access="0" id="isInCockpit" value="true" type="4" typeOther="" />
+<Attribute access="0" id="knowsEmergencyCode" value="true" type="4" typeOther="" />
+<Attribute access="0" id="code" value="" type="5" typeOther="Code" />
 </extraparam>
 </SUBCOMPONENT>
 
@@ -2432,11 +2432,11 @@ DoorAndLockButton.IN_EMERGENCY_CALL --&gt; DoorAndLockButton.CLOSED_AND_LOCKED |
 </COMPONENT>
 <SUBCOMPONENT type="5000" id="1469" >
 <father id="1519" num="0" />
-<cdparam x="757" y="299" />
-<sizeparam width="250" height="200" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="757" y="83" />
+<sizeparam width="250" height="205" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="751" minY="0" maxY="290" />
-<infoparam name="Block0" value="Keyboard" />
+<cdrectangleparam minX="0" maxX="751" minY="0" maxY="285" />
+<infoparam name="Block0" value="DoorAndLockButton" />
 <TGConnectingPoint num="0" id="1445" />
 <TGConnectingPoint num="1" id="1446" />
 <TGConnectingPoint num="2" id="1447" />
@@ -2464,8 +2464,9 @@ DoorAndLockButton.IN_EMERGENCY_CALL --&gt; DoorAndLockButton.CLOSED_AND_LOCKED |
 <extraparam>
 <blockType data="cryptoblock" color="-4072719" />
 <CryptoBlock value="true" />
-<Attribute access="0" id="codeValue" value="" type="8" typeOther="" />
-<Attribute access="0" id="code" value="" type="5" typeOther="Code" />
+<Attribute access="0" id="inside" value="2" type="8" typeOther="" />
+<Attribute access="0" id="outside" value="2" type="8" typeOther="" />
+<Attribute access="0" id="timeout" value="0" type="8" typeOther="" />
 <Attribute access="0" id="m" value="" type="5" typeOther="Message" />
 <Attribute access="0" id="sk" value="" type="5" typeOther="Key" />
 <Attribute access="0" id="m1" value="" type="5" typeOther="Message" />
@@ -2489,16 +2490,22 @@ DoorAndLockButton.IN_EMERGENCY_CALL --&gt; DoorAndLockButton.CLOSED_AND_LOCKED |
 <Method value="get2(Message msg, Message msg1, Message msg2)" />
 <Method value="get3(Message msg, Message msg1, Message msg2, Message msg3)" />
 <Method value="get4(Message msg, Message msg1, Message msg2, Message msg3, Message msg4)" />
-<Signal value="in code(int codeValue)" attached="true" />
+<Signal value="in lock()" attached="true" />
+<Signal value="in unlock()" attached="true" />
+<Signal value="in open()" attached="true" />
+<Signal value="in close()" attached="true" />
+<Signal value="in enterCockpit()" attached="true" />
+<Signal value="in leaveCockpit()" attached="true" />
+<Signal value="in emergencyCall()" attached="false" />
 </extraparam>
 </SUBCOMPONENT>
 <SUBCOMPONENT type="5000" id="1494" >
 <father id="1519" num="1" />
-<cdparam x="757" y="83" />
-<sizeparam width="250" height="205" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="757" y="299" />
+<sizeparam width="250" height="200" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="751" minY="0" maxY="285" />
-<infoparam name="Block0" value="DoorAndLockButton" />
+<cdrectangleparam minX="0" maxX="751" minY="0" maxY="290" />
+<infoparam name="Block0" value="Keyboard" />
 <TGConnectingPoint num="0" id="1470" />
 <TGConnectingPoint num="1" id="1471" />
 <TGConnectingPoint num="2" id="1472" />
@@ -2526,9 +2533,8 @@ DoorAndLockButton.IN_EMERGENCY_CALL --&gt; DoorAndLockButton.CLOSED_AND_LOCKED |
 <extraparam>
 <blockType data="cryptoblock" color="-4072719" />
 <CryptoBlock value="true" />
-<Attribute access="0" id="inside" value="2" type="8" typeOther="" />
-<Attribute access="0" id="outside" value="2" type="8" typeOther="" />
-<Attribute access="0" id="timeout" value="0" type="8" typeOther="" />
+<Attribute access="0" id="codeValue" value="" type="8" typeOther="" />
+<Attribute access="0" id="code" value="" type="5" typeOther="Code" />
 <Attribute access="0" id="m" value="" type="5" typeOther="Message" />
 <Attribute access="0" id="sk" value="" type="5" typeOther="Key" />
 <Attribute access="0" id="m1" value="" type="5" typeOther="Message" />
@@ -2552,13 +2558,7 @@ DoorAndLockButton.IN_EMERGENCY_CALL --&gt; DoorAndLockButton.CLOSED_AND_LOCKED |
 <Method value="get2(Message msg, Message msg1, Message msg2)" />
 <Method value="get3(Message msg, Message msg1, Message msg2, Message msg3)" />
 <Method value="get4(Message msg, Message msg1, Message msg2, Message msg3, Message msg4)" />
-<Signal value="in lock()" attached="true" />
-<Signal value="in unlock()" attached="true" />
-<Signal value="in open()" attached="true" />
-<Signal value="in close()" attached="true" />
-<Signal value="in enterCockpit()" attached="true" />
-<Signal value="in leaveCockpit()" attached="true" />
-<Signal value="in emergencyCall()" attached="false" />
+<Signal value="in code(int codeValue)" attached="true" />
 </extraparam>
 </SUBCOMPONENT>
 
@@ -6188,7 +6188,7 @@ DoorAndLockButton.IN_EMERGENCY_CALL --&gt; DoorAndLockButton.CLOSED_AND_LOCKED |
 <sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <infoparam name="connector" value="" />
 <TGConnectingPoint num="0" id="3042" />
-<P1  x="839" y="296" id="3224" />
+<P1  x="839" y="296" id="3199" />
 <P2  x="802" y="303" id="3081" />
 <AutomaticDrawing  data="true" />
 <extraparam>
@@ -6203,7 +6203,7 @@ DoorAndLockButton.IN_EMERGENCY_CALL --&gt; DoorAndLockButton.CLOSED_AND_LOCKED |
 <infoparam name="connector" value="" />
 <TGConnectingPoint num="0" id="3044" />
 <P1  x="802" y="205" id="3088" />
-<P2  x="1094" y="139" id="3199" />
+<P2  x="1094" y="139" id="3224" />
 <AutomaticDrawing  data="true" />
 <extraparam>
 <isd value="in lock()" />
@@ -6573,11 +6573,11 @@ in DoorAndLockButton
 </COMPONENT>
 <SUBCOMPONENT type="5000" id="3213" >
 <father id="3263" num="0" />
-<cdparam x="1094" y="88" />
-<sizeparam width="212" height="205" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="839" y="246" />
+<sizeparam width="250" height="200" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="1075" minY="0" maxY="293" />
-<infoparam name="Block0" value="DoorAndLockButton" />
+<cdrectangleparam minX="0" maxX="1037" minY="0" maxY="298" />
+<infoparam name="Block0" value="Keyboard" />
 <TGConnectingPoint num="0" id="3189" />
 <TGConnectingPoint num="1" id="3190" />
 <TGConnectingPoint num="2" id="3191" />
@@ -6605,9 +6605,8 @@ in DoorAndLockButton
 <extraparam>
 <blockType data="cryptoblock" color="-4072719" />
 <CryptoBlock value="true" />
-<Attribute access="0" id="inside" value="2" type="8" typeOther="" />
-<Attribute access="0" id="outside" value="2" type="8" typeOther="" />
-<Attribute access="0" id="timeout" value="0" type="8" typeOther="" />
+<Attribute access="0" id="codeValue" value="" type="8" typeOther="" />
+<Attribute access="0" id="code" value="" type="5" typeOther="Code" />
 <Attribute access="0" id="m" value="" type="5" typeOther="Message" />
 <Attribute access="0" id="sk" value="" type="5" typeOther="Key" />
 <Attribute access="0" id="m1" value="" type="5" typeOther="Message" />
@@ -6631,22 +6630,16 @@ in DoorAndLockButton
 <Method value="get2(Message msg, Message msg1, Message msg2)" />
 <Method value="get3(Message msg, Message msg1, Message msg2, Message msg3)" />
 <Method value="get4(Message msg, Message msg1, Message msg2, Message msg3, Message msg4)" />
-<Signal value="in lock()" attached="true" />
-<Signal value="in unlock()" attached="true" />
-<Signal value="in open()" attached="true" />
-<Signal value="in close()" attached="true" />
-<Signal value="in enterCockpit()" attached="true" />
-<Signal value="in leaveCockpit()" attached="true" />
-<Signal value="in emergencyCall()" attached="false" />
+<Signal value="in code(int codeValue)" attached="true" />
 </extraparam>
 </SUBCOMPONENT>
 <SUBCOMPONENT type="5000" id="3238" >
 <father id="3263" num="1" />
-<cdparam x="839" y="246" />
-<sizeparam width="250" height="200" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<cdparam x="1094" y="88" />
+<sizeparam width="212" height="205" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
 <hidden value="false" />
-<cdrectangleparam minX="0" maxX="1037" minY="0" maxY="298" />
-<infoparam name="Block0" value="Keyboard" />
+<cdrectangleparam minX="0" maxX="1075" minY="0" maxY="293" />
+<infoparam name="Block0" value="DoorAndLockButton" />
 <TGConnectingPoint num="0" id="3214" />
 <TGConnectingPoint num="1" id="3215" />
 <TGConnectingPoint num="2" id="3216" />
@@ -6674,8 +6667,9 @@ in DoorAndLockButton
 <extraparam>
 <blockType data="cryptoblock" color="-4072719" />
 <CryptoBlock value="true" />
-<Attribute access="0" id="codeValue" value="" type="8" typeOther="" />
-<Attribute access="0" id="code" value="" type="5" typeOther="Code" />
+<Attribute access="0" id="inside" value="2" type="8" typeOther="" />
+<Attribute access="0" id="outside" value="2" type="8" typeOther="" />
+<Attribute access="0" id="timeout" value="0" type="8" typeOther="" />
 <Attribute access="0" id="m" value="" type="5" typeOther="Message" />
 <Attribute access="0" id="sk" value="" type="5" typeOther="Key" />
 <Attribute access="0" id="m1" value="" type="5" typeOther="Message" />
@@ -6699,7 +6693,13 @@ in DoorAndLockButton
 <Method value="get2(Message msg, Message msg1, Message msg2)" />
 <Method value="get3(Message msg, Message msg1, Message msg2, Message msg3)" />
 <Method value="get4(Message msg, Message msg1, Message msg2, Message msg3, Message msg4)" />
-<Signal value="in code(int codeValue)" attached="true" />
+<Signal value="in lock()" attached="true" />
+<Signal value="in unlock()" attached="true" />
+<Signal value="in open()" attached="true" />
+<Signal value="in close()" attached="true" />
+<Signal value="in enterCockpit()" attached="true" />
+<Signal value="in leaveCockpit()" attached="true" />
+<Signal value="in emergencyCall()" attached="false" />
 </extraparam>
 </SUBCOMPONENT>
 
diff --git a/src/main/java/ui/ActionPerformer.java b/src/main/java/ui/ActionPerformer.java
index 1f281acb58..af62c015ac 100644
--- a/src/main/java/ui/ActionPerformer.java
+++ b/src/main/java/ui/ActionPerformer.java
@@ -493,6 +493,8 @@ public class ActionPerformer {
             mgui.actionOnButton(TGComponentManager.CONNECTOR, TGComponentManager.ACD_ASSOCIATION_CONNECTOR);
         } else if (command.equals(mgui.actions[TGUIAction.ACD_COMPOSITION_CONNECTOR].getActionCommand())) {
             mgui.actionOnButton(TGComponentManager.CONNECTOR, TGComponentManager.ACD_COMPOSITION_CONNECTOR);
+        } else if (command.equals(mgui.actions[TGUIAction.ACD_AGGREGATION_CONNECTOR].getActionCommand())) {
+            mgui.actionOnButton(TGComponentManager.CONNECTOR, TGComponentManager.ACD_AGGREGATION_CONNECTOR);
 
             // AVATAR AD
         } else if (command.equals(mgui.actions[TGUIAction.AAD_EDIT].getActionCommand())) {
diff --git a/src/main/java/ui/TGComponentManager.java b/src/main/java/ui/TGComponentManager.java
index 817668c663..f4e728e43f 100644
--- a/src/main/java/ui/TGComponentManager.java
+++ b/src/main/java/ui/TGComponentManager.java
@@ -514,6 +514,7 @@ public class TGComponentManager {
     public static final int ACD_ACTOR_BOX = 5402;
     public static final int ACD_COMPOSITION_CONNECTOR = 5403;
     public static final int ACD_ASSOCIATION_CONNECTOR = 5404;
+    public static final int ACD_AGGREGATION_CONNECTOR = 5405;
 
     // AVATAR AD -> starts at 5500
     public static final int AAD_ASSOCIATION_CONNECTOR = 5500;
@@ -1783,6 +1784,8 @@ public class TGComponentManager {
             return ACD_ACTOR_BOX;
         } else if (tgc instanceof AvatarCDCompositionConnector) {
             return ACD_COMPOSITION_CONNECTOR;
+        } else if (tgc instanceof AvatarCDAggregationConnector) {
+            return ACD_AGGREGATION_CONNECTOR;
         } else if (tgc instanceof AvatarCDAssociationConnector) {
             return ACD_ASSOCIATION_CONNECTOR;
 
@@ -2449,6 +2452,10 @@ public class TGComponentManager {
             case ACD_COMPOSITION_CONNECTOR:
                 tgc = new AvatarCDCompositionConnector(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp, p1, p2, listPoint);
                 break;
+            case ACD_AGGREGATION_CONNECTOR:
+                tgc = new AvatarCDAggregationConnector(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp, p1, p2,
+                        listPoint);
+                break;
             case ACD_ASSOCIATION_CONNECTOR:
                 tgc = new AvatarCDAssociationConnector(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp, p1, p2, listPoint);
                 break;
diff --git a/src/main/java/ui/TGUIAction.java b/src/main/java/ui/TGUIAction.java
index 57cbc9a213..3a47bf62e9 100644
--- a/src/main/java/ui/TGUIAction.java
+++ b/src/main/java/ui/TGUIAction.java
@@ -516,6 +516,7 @@ public class TGUIAction extends AbstractAction {
     public static final int ACD_EDIT = 344;
     public static final int ACD_BLOCK = 345;
     public static final int ACD_COMPOSITION_CONNECTOR = 346;
+    public static final int ACD_AGGREGATION_CONNECTOR = 530;
     public static final int ACD_ACTOR_STICKMAN = 347;
     public static final int ACD_ACTOR_BOX = 348;
     public static final int ACD_ASSOCIATION_CONNECTOR = 349;
@@ -685,7 +686,7 @@ public class TGUIAction extends AbstractAction {
 
     public static final int MOVE_ENABLED = 463;
     public static final int FIRST_DIAGRAM = 464;   
-    public static final int NB_ACTION = 530;
+    public static final int NB_ACTION = 531;
 
     private static final TAction [] actions = new TAction[NB_ACTION];
 
@@ -1399,6 +1400,8 @@ public class TGUIAction extends AbstractAction {
         actions[ACD_EDIT] = new TAction("edit-acd-diagram", "Edit AVATAR Context Diagrams", IconManager.imgic100, IconManager.imgic101, "Edit AVATAR Context Diagram", "Make it possible to edit the currently opened AVATAR Context Diagram", 0);
         actions[ACD_BLOCK] = new TAction("acd-block", "Add a block", IconManager.imgic5000, IconManager.imgic5000, "Block", "Add a SysML Block to the currently opened AVATAR Context Diagram", 0);
         actions[ACD_COMPOSITION_CONNECTOR] = new TAction("acd-composition-connector", "Add a composition between blocks", IconManager.imgic5002, IconManager.imgic5002, "Composition between blocks", "Add a composition between blocks to the currently opened AVATAR Context Diagram", 0);
+        actions[ACD_AGGREGATION_CONNECTOR] = new TAction("acd-aggregation-connector", "Add an aggregation between blocks", IconManager.imgic5078,
+         IconManager.imgic5078, "Aggregation between blocks", "Add an aggregation between blocks to the currently opened AVATAR Context Diagram", 0);
         actions[ACD_ASSOCIATION_CONNECTOR] = new TAction("acd-association-connector", "Add an association", IconManager.imgic5044, IconManager.imgic5044, "Association", "Add an association between blocks to the currently opened AVATAR Context Diagram", 0);
         actions[ACD_ACTOR_STICKMAN] = new TAction("acd-add-actor", "Add an actor (stickman format)", IconManager.imgic600, IconManager.imgic600, "Actor", "Add a stickman actor to the currently opened AVATAR Context diagram", 0);
         actions[ACD_ACTOR_BOX] = new TAction("acd-add-actor-box", "Add an actor (box format)", IconManager.imgic614, IconManager.imgic614, "Actor (box format)", "Add a box actor  to the currently opened AVATAR Context diagram", 0);
diff --git a/src/main/java/ui/avatarcd/AvatarCDAggregationConnector.java b/src/main/java/ui/avatarcd/AvatarCDAggregationConnector.java
new file mode 100644
index 0000000000..876f46b9f2
--- /dev/null
+++ b/src/main/java/ui/avatarcd/AvatarCDAggregationConnector.java
@@ -0,0 +1,188 @@
+/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ * 
+ * ludovic.apvrille AT enst.fr
+ * 
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ * 
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ * 
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ * 
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ * 
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package ui.avatarcd;
+
+import ui.*;
+import ui.util.IconManager;
+
+import java.awt.*;
+import java.util.Vector;
+
+/**
+* Class AvatarCDAggragationConnector
+* Connector used in AVATAR Context Diagrams
+* Creation: 05/01/2021
+* @version 1.0 05/01/2021
+* @author Ludovic APVRILLE
+ */
+public  class AvatarCDAggregationConnector extends TGConnectorWithCommentConnectionPoints /* Issue #31 implements ScalableTGComponent*/ {
+    protected int d = 20;
+	protected int D = 26;
+    //protected int widthValue, heightValue, maxWidthValue, h;
+	protected Polygon p;
+	protected int xp1, xp2, yp1, yp2;
+//	protected double oldScaleFactor;
+//	protected boolean rescaled;
+	
+    
+    public AvatarCDAggregationConnector(int _x, int _y, int _minX, int _minY, int _maxX, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp, TGConnectingPoint _p1, TGConnectingPoint _p2, Vector<Point> _listPoint) {
+        super(_x, _y,  _minX, _minY, _maxX, _maxY, _pos, _father, _tdp, _p1, _p2, _listPoint);
+       
+        myImageIcon = IconManager.imgic202;
+
+        value = "{info}";
+        editable = true;
+//		oldScaleFactor = tdp.getZoom();
+//		rescaled = true;
+    }
+    
+    @Override
+    protected void drawLastSegment(Graphics g, int x1, int y1, int x2, int y2) {
+		if ((p == null) || (rescaled) || (xp1 != x1) || (xp2 != x2) || (yp1 != y1) || (yp2 != y2)){
+			p = new Polygon();
+			xp1 = x1;
+			xp2 = x2;
+			yp1 = y1;
+			yp2 = y2;
+			//Double alpha;
+			
+			int dd = (int)(d*tdp.getZoom());
+			int DD = (int)(D*tdp.getZoom());
+			
+			if (x1 == x2) {
+				if (y1 > y2) {
+					p.addPoint(x2, y2+DD);
+					p.addPoint(x2+(dd/2), y2+(DD/2));
+					p.addPoint(x2, y2);
+					p.addPoint(x2-(dd/2), y2+(DD/2));
+				} else {
+					p.addPoint(x2, y2-DD);
+					p.addPoint(x2+(dd/2), y2-(DD/2));
+					p.addPoint(x2, y2);
+					p.addPoint(x2-(dd/2), y2-(DD/2));
+				}
+			} else {
+				double xd[] = new double[4];
+				double yd[] = new double[4];
+				
+				
+				//P
+				xd[0] = x2;
+				yd[0] = y2;
+				
+				int x0 = x1 - x2;
+				int y0 = y1 - y2;
+				double k = 1/(Math.sqrt((x0*x0)+(y0*y0)));
+				double u = x0*k;
+				double v = y0*k;
+				
+				double Ex = DD*u;
+				double Ey = DD*v;
+				double Fx = dd*v;
+				double Fy = -dd*u;
+				
+				//Q
+				xd[1] = x2+((Ex+Fx)/2);
+				yd[1] = y2+((Ey+Fy)/2);
+				
+				//R
+				xd[2] = x2+Ex;
+				yd[2] = y2+Ey;
+				
+				//S
+				xd[3] = xd[1] - Fx;
+				yd[3] = yd[1] - Fy;
+				
+				for(int i=0; i<4; i++) {
+					p.addPoint((int)xd[i], (int)yd[i]);
+				}
+			}
+			
+		}
+		g.drawLine(x1, y1, x2, y2);
+		Color c = g.getColor();
+		g.setColor(Color.WHITE);
+		g.fillPolygon(p);
+		g.setColor(c);
+		g.drawPolygon(p);
+
+		rescaled = false;
+    }
+	
+    @Override
+	public TGComponent extraIsOnOnlyMe(int x1, int y1) {
+		if (p != null) {
+			if (p.contains(x1, y1)) {
+				return this;
+			}
+		}
+		
+        return null;
+    }
+	
+//	Issue #31 Now managed in upper class 
+//    public void rescale(double scaleFactor){
+//		//
+//		int xx, yy;
+//		
+//		for(int i=0; i<nbInternalTGComponent; i++) {
+//			xx = tgcomponent[i].getX();
+//			yy = tgcomponent[i].getY();
+//			//
+//			tgcomponent[i].dx = (tgcomponent[i].dx + xx) / oldScaleFactor * scaleFactor;
+//			tgcomponent[i].dy = (tgcomponent[i].dy + yy) / oldScaleFactor * scaleFactor;
+//			xx = (int)(tgcomponent[i].dx);
+//			tgcomponent[i].dx = tgcomponent[i].dx - xx;
+//			yy = (int)(tgcomponent[i].dy);
+//			tgcomponent[i].dy = tgcomponent[i].dy - yy;
+//			
+//			tgcomponent[i].setCd(xx, yy);
+//			
+//			//
+//        }
+//		
+//		oldScaleFactor = scaleFactor;
+//		rescaled = true;
+//	}
+    
+	@Override
+    public int getType() {
+        return TGComponentManager.ACD_AGGREGATION_CONNECTOR;
+    }
+}
diff --git a/src/main/java/ui/avatarcd/AvatarCDBlock.java b/src/main/java/ui/avatarcd/AvatarCDBlock.java
index 23176cd7bd..c5865b54e1 100644
--- a/src/main/java/ui/avatarcd/AvatarCDBlock.java
+++ b/src/main/java/ui/avatarcd/AvatarCDBlock.java
@@ -180,7 +180,7 @@ public class AvatarCDBlock extends TGCScalableWithInternalComponent implements S
         if (currentHeight < height) {
             //g.drawLine(x, y+h, x+width, y+h);
             g.setColor(new Color(avat.getRed(), avat.getGreen(), Math.min(255, avat.getBlue() + (getMyDepth() * 10))));
-            g.fill3DRect(x + 1, y + currentHeight, width - 1, height - 1 - currentHeight, true);
+            g.fill3DRect(x + 1, y + currentHeight+1, width - 1, height - 1 - currentHeight, true);
             g.setColor(c);
         }
     }
diff --git a/src/main/java/ui/avatarcd/AvatarCDConnectingPoint.java b/src/main/java/ui/avatarcd/AvatarCDConnectingPoint.java
index cb7d892fa8..13bd13f3f1 100644
--- a/src/main/java/ui/avatarcd/AvatarCDConnectingPoint.java
+++ b/src/main/java/ui/avatarcd/AvatarCDConnectingPoint.java
@@ -60,6 +60,9 @@ public class AvatarCDConnectingPoint extends TGConnectingPointWidthHeight {
         if (type == TGComponentManager.ACD_COMPOSITION_CONNECTOR) {
             return true;
         }
+        if (type == TGComponentManager.ACD_AGGREGATION_CONNECTOR) {
+            return true;
+        }
         return type == TGComponentManager.ACD_ASSOCIATION_CONNECTOR;
     }
 }
diff --git a/src/main/java/ui/avatarcd/AvatarCDToolBar.java b/src/main/java/ui/avatarcd/AvatarCDToolBar.java
index 5165be73d1..e365606839 100644
--- a/src/main/java/ui/avatarcd/AvatarCDToolBar.java
+++ b/src/main/java/ui/avatarcd/AvatarCDToolBar.java
@@ -80,6 +80,7 @@ public class AvatarCDToolBar extends TToolBar {
 		
 		mgui.actions[TGUIAction.ACD_BLOCK].setEnabled(b);
 		mgui.actions[TGUIAction.ACD_COMPOSITION_CONNECTOR].setEnabled(b);
+        mgui.actions[TGUIAction.ACD_AGGREGATION_CONNECTOR].setEnabled(b);
 		mgui.actions[TGUIAction.ACD_ASSOCIATION_CONNECTOR].setEnabled(b);
 		mgui.actions[TGUIAction.ACD_ACTOR_BOX].setEnabled(b);
 		mgui.actions[TGUIAction.ACD_ACTOR_STICKMAN].setEnabled(b);
@@ -111,12 +112,15 @@ public class AvatarCDToolBar extends TToolBar {
 		
 		button = this.add(mgui.actions[TGUIAction.ACD_COMPOSITION_CONNECTOR]);
         button.addMouseListener(mgui.mouseHandler);
+
+        button = this.add(mgui.actions[TGUIAction.ACD_AGGREGATION_CONNECTOR]);
+        button.addMouseListener(mgui.mouseHandler);
 		
 		this.addSeparator();
 		
 		button = this.add(mgui.actions[TGUIAction.ACD_ACTOR_STICKMAN]);
         button.addMouseListener(mgui.mouseHandler);
-		
+
 		button = this.add(mgui.actions[TGUIAction.ACD_ACTOR_BOX]);
         button.addMouseListener(mgui.mouseHandler);
 		
diff --git a/src/main/java/ui/util/IconManager.java b/src/main/java/ui/util/IconManager.java
index c3b3f9298b..6675fdbff2 100755
--- a/src/main/java/ui/util/IconManager.java
+++ b/src/main/java/ui/util/IconManager.java
@@ -158,7 +158,7 @@ public class IconManager {
     public static ImageIcon imgic5040, imgic5042, imgic5044, imgic5046, imgic5048;
     public static ImageIcon imgic5050, imgic5052, imgic5054, imgic5056, imgic5058;
     public static ImageIcon imgic5060, imgic5062, imgic5064, imgic5066, imgic5068;
-    public static ImageIcon imgic5070, imgic5072, imgic5074, imgic5076;
+    public static ImageIcon imgic5070, imgic5072, imgic5074, imgic5076, imgic5078;
 
     public static ImageIcon imgic5100, imgic5102, imgic5104, imgic5106, imgic5108;
     public static ImageIcon imgic5110, imgic5112, imgic5113, imgic5114, imgic5116;
@@ -642,6 +642,7 @@ public class IconManager {
     private static String icon5072 = "scissors.png";
     private static String icon5074 = "avatarrdreqref.gif";
     private static String icon5076 = "avataramsinterface.gif";
+    private static String icon5078 = "avatarbdaggre.gif";
 
     private static String icon5100 = "avatarhead16.gif";
     private static String icon5102 = "avatarhead32.gif";
@@ -1178,6 +1179,7 @@ public class IconManager {
         }
         imgic5074 = getIcon(icon5074);
         imgic5076 = getIcon(icon5076);
+        imgic5078 = getIcon(icon5078);
 
         imgic5100 = getIcon(icon5100);
         imgic5102 = getIcon(icon5102);
diff --git a/src/main/resources/ui/util/avatarbdaggre.gif b/src/main/resources/ui/util/avatarbdaggre.gif
new file mode 100644
index 0000000000000000000000000000000000000000..f4a16e4573962badfc8d130e613055569267a2a5
GIT binary patch
literal 113
zcmZ?wbhEHb<Yy3IIK%(~2XB2mcmLP_|Np@}D53b1g^`Pag+T|z2dQOXHuK=R$fu?E
zy(LB=J3(JifxS$QktaZMF7v8cxpSuJaP3?EL+{DCx2x}^ZeAEDwf~{vgeeAnXIU7m
E0ntt)b^rhX

literal 0
HcmV?d00001

-- 
GitLab