Skip to content
Snippets Groups Projects
Commit 5c129937 authored by apvrille's avatar apvrille
Browse files

Update on countermeasures: first stable version

parent 3fec4583
No related branches found
No related tags found
No related merge requests found
...@@ -67,7 +67,7 @@ public class ATDCountermeasure extends TGCScalableWithInternalComponent implemen ...@@ -67,7 +67,7 @@ public class ATDCountermeasure extends TGCScalableWithInternalComponent implemen
protected String description = ""; protected String description = "";
private String stereotype = "countermeasure"; private String stereotype = "countermeasure";
private static int decPar = 20; private static double percentageDecPar = 0.15;
private static int maxFontSize = 14; private static int maxFontSize = 14;
private static int minFontSize = 4; private static int minFontSize = 4;
...@@ -86,15 +86,15 @@ public class ATDCountermeasure extends TGCScalableWithInternalComponent implemen ...@@ -86,15 +86,15 @@ public class ATDCountermeasure extends TGCScalableWithInternalComponent implemen
connectingPoint = new TGConnectingPoint[12]; connectingPoint = new TGConnectingPoint[12];
connectingPoint[0] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.5, 0.0); connectingPoint[0] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.5, 0.0);
connectingPoint[1] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.0, 0.5); connectingPoint[1] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.0 - percentageDecPar/2, 0.5);
connectingPoint[2] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 1.0, 0.5); connectingPoint[2] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 1.0 + percentageDecPar/2 , 0.5);
connectingPoint[3] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.5, 1.0); connectingPoint[3] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.5, 1.0);
connectingPoint[4] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.25, 0.0); connectingPoint[4] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.25, 0.0);
connectingPoint[5] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.75, 0.0); connectingPoint[5] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.75, 0.0);
connectingPoint[6] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.0, 0.25); connectingPoint[6] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.0 - percentageDecPar/4, 0.25);
connectingPoint[7] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 1.0, 0.25); connectingPoint[7] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 1.0 + percentageDecPar * 0.75, 0.25);
connectingPoint[8] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.0, 0.75); connectingPoint[8] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.0 - percentageDecPar * 0.75, 0.75);
connectingPoint[9] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 1.0, 0.75); connectingPoint[9] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 1.0 + percentageDecPar * 0.25, 0.75);
connectingPoint[10] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.25, 1.0); connectingPoint[10] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.25, 1.0);
connectingPoint[11] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.75, 1.0); connectingPoint[11] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.75, 1.0);
//addTGConnectingPointsComment(); //addTGConnectingPointsComment();
...@@ -141,14 +141,13 @@ public class ATDCountermeasure extends TGCScalableWithInternalComponent implemen ...@@ -141,14 +141,13 @@ public class ATDCountermeasure extends TGCScalableWithInternalComponent implemen
} }
// Core of the countermeasure // Core of the countermeasure
Color c = g.getColor(); Color c = g.getColor();
Polygon p = new Polygon(); Polygon p = getMyPolygon();
g.draw3DRect(x, y, width, height, true);
g.setColor(ColorManager.ATD_COUNTERMEASURE); g.setColor(ColorManager.ATD_COUNTERMEASURE);
g.fillPolygon(p);
g.setColor(c);
g.drawPolygon(p);
g.fill3DRect(x+1, y+1, width-1, height-1, true);
g.setColor(c);
// Strings // Strings
int w; int w;
...@@ -204,6 +203,15 @@ public class ATDCountermeasure extends TGCScalableWithInternalComponent implemen ...@@ -204,6 +203,15 @@ public class ATDCountermeasure extends TGCScalableWithInternalComponent implemen
} }
private Polygon getMyPolygon() {
Polygon p = new Polygon();
p.addPoint(x, y);
p.addPoint((int)(x+width+(percentageDecPar*width)), y);
p.addPoint(x+width, y+height);
p.addPoint((int)(x-(percentageDecPar*width)), y+height);
return p;
}
public void setValue(String val, Graphics g) { public void setValue(String val, Graphics g) {
oldValue = value; oldValue = value;
String ster; String ster;
...@@ -285,10 +293,10 @@ public class ATDCountermeasure extends TGCScalableWithInternalComponent implemen ...@@ -285,10 +293,10 @@ public class ATDCountermeasure extends TGCScalableWithInternalComponent implemen
} }
public TGComponent isOnOnlyMe(int x1, int y1) { public TGComponent isOnOnlyMe(int x1, int y1) {
Polygon p = getMyPolygon();
if (GraphicLib.isInRectangle(x1, y1, x, y, width, height)) { if (p.contains(x1, y1)) {
return this; return this;
} }
return null; return null;
} }
......
src/ui/images/atdcountermeasure.gif

100 B | W: | H:

src/ui/images/atdcountermeasure.gif

104 B | W: | H:

src/ui/images/atdcountermeasure.gif
src/ui/images/atdcountermeasure.gif
src/ui/images/atdcountermeasure.gif
src/ui/images/atdcountermeasure.gif
  • 2-up
  • Swipe
  • Onion skin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment