Adjusted boat drawing to displayMode.

This commit is contained in:
Radeck authored and Leon Radeck committed 2017-06-03 17:56:22 +02:00
1 parent d1399b924d
commit 890994551e
8 files changed
+217 -70

No files matched your search

@@ -29,6 +29,7 @@ import com.sap.sse.common.Color;
public abstract class BoatClassVectorGraphics {
protected static final String SAIL_FILLCOLOR = "#888888";
protected static final String SAIL_STROKECOLOR = "#000000";
protected static final double BOAT_NOT_SELECTED_OPACITY = 0.3;
/** the minimal length of the hull in pixel when the boat is drawn */
private static final double MIN_HULL_LENGTH_IN_PX = 25;
@@ -16,7 +16,7 @@ public class DinghyWithSpinnakerVectorGraphics extends BoatClassVectorGraphics {
ctx.translate(0,-823);
//draw hull
//draw cockpit
switch (displayMode){
case DEFAULT:
ctx.setFillStyle ("#FFFFFF");
@@ -27,9 +27,9 @@ public class DinghyWithSpinnakerVectorGraphics extends BoatClassVectorGraphics {
ctx.setStrokeStyle(color);
break;
case NOT_SELECTED:
ctx.setGlobalAlpha(0.1);
ctx.setFillStyle(color);
ctx.setStrokeStyle(color);
ctx.setGlobalAlpha(BOAT_NOT_SELECTED_OPACITY);
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
break;
}
@@ -53,8 +53,9 @@ public class DinghyWithSpinnakerVectorGraphics extends BoatClassVectorGraphics {
ctx.setStrokeStyle("#FFFFFF");
break;
case NOT_SELECTED:
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
ctx.setGlobalAlpha(BOAT_NOT_SELECTED_OPACITY);
ctx.setFillStyle(color);
ctx.setStrokeStyle(color);
break;
}
@@ -14,13 +14,23 @@ public class Extreme40VectorGraphics extends BoatClassVectorGraphics {
@Override
protected void drawBoat(Context2d ctx, DisplayMode displayMode, String color) {
// outer net
if(displayMode == DisplayMode.SELECTED) {
ctx.setFillStyle(color);
ctx.setStrokeStyle(color);
} else {
switch (displayMode){
case DEFAULT:
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
break;
case SELECTED:
ctx.setFillStyle (color);
ctx.setStrokeStyle(color);
break;
case NOT_SELECTED:
ctx.setGlobalAlpha(BOAT_NOT_SELECTED_OPACITY);
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
break;
}
ctx.setLineWidth(1.0);
ctx.beginPath();
ctx.moveTo(195,72);
@@ -36,14 +46,24 @@ public class Extreme40VectorGraphics extends BoatClassVectorGraphics {
ctx.fill();
ctx.stroke();
// inner net
if(displayMode == DisplayMode.SELECTED) {
ctx.setFillStyle("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
} else {
ctx.setFillStyle(color);
// inner net
switch (displayMode){
case DEFAULT:
ctx.setFillStyle (color);
ctx.setStrokeStyle(color);
break;
case SELECTED:
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
break;
case NOT_SELECTED:
ctx.setGlobalAlpha(BOAT_NOT_SELECTED_OPACITY);
ctx.setFillStyle (color);
ctx.setStrokeStyle(color);
break;
}
ctx.setLineWidth(1.0);
ctx.beginPath();
ctx.moveTo(271,163);
@@ -60,13 +80,23 @@ public class Extreme40VectorGraphics extends BoatClassVectorGraphics {
ctx.stroke();
// hull - left and right part
if(displayMode == DisplayMode.SELECTED) {
ctx.setFillStyle(color);
ctx.setStrokeStyle(color);
} else {
ctx.setFillStyle("#FFFFFF");
switch (displayMode){
case DEFAULT:
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#000000");
break;
case SELECTED:
ctx.setFillStyle (color);
ctx.setStrokeStyle(color);
break;
case NOT_SELECTED:
ctx.setGlobalAlpha(BOAT_NOT_SELECTED_OPACITY);
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#000000");
break;
}
ctx.setLineWidth(5.0);
ctx.setLineJoin(LineJoin.ROUND);
ctx.beginPath();
@@ -20,13 +20,23 @@ public class GC32VectorGraphics extends BoatClassVectorGraphics {
@Override
protected void drawBoat(Context2d ctx, DisplayMode displayMode, String color) {
// outer net
if(displayMode == DisplayMode.SELECTED) {
ctx.setFillStyle(color);
ctx.setStrokeStyle(color);
} else {
switch (displayMode){
case DEFAULT:
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
break;
case SELECTED:
ctx.setFillStyle (color);
ctx.setStrokeStyle(color);
break;
case NOT_SELECTED:
ctx.setGlobalAlpha(BOAT_NOT_SELECTED_OPACITY);
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
break;
}
ctx.setLineWidth(1.0);
ctx.beginPath();
ctx.moveTo(195,72);
@@ -43,13 +53,23 @@ public class GC32VectorGraphics extends BoatClassVectorGraphics {
ctx.stroke();
// inner net
if(displayMode == DisplayMode.SELECTED) {
ctx.setFillStyle("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
} else {
ctx.setFillStyle(color);
switch (displayMode){
case DEFAULT:
ctx.setFillStyle (color);
ctx.setStrokeStyle(color);
break;
case SELECTED:
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
break;
case NOT_SELECTED:
ctx.setGlobalAlpha(BOAT_NOT_SELECTED_OPACITY);
ctx.setFillStyle (color);
ctx.setStrokeStyle(color);
break;
}
ctx.setLineWidth(1.0);
ctx.beginPath();
ctx.moveTo(271,163);
@@ -66,13 +86,23 @@ public class GC32VectorGraphics extends BoatClassVectorGraphics {
ctx.stroke();
// hull - left and right part
if(displayMode == DisplayMode.SELECTED) {
switch (displayMode){
case DEFAULT:
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
break;
case SELECTED:
ctx.setFillStyle(color);
ctx.setStrokeStyle(color);
} else {
ctx.setFillStyle("#FFFFFF");
ctx.setStrokeStyle("#000000");
break;
case NOT_SELECTED:
ctx.setGlobalAlpha(BOAT_NOT_SELECTED_OPACITY);
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
break;
}
ctx.setLineWidth(5.0);
ctx.setLineJoin(LineJoin.ROUND);
ctx.beginPath();
@@ -16,13 +16,23 @@ public class KeelBoatWithGennakerVectorGraphics extends BoatClassVectorGraphics
ctx.translate(0,-803);
//draw hull
if(displayMode == DisplayMode.SELECTED) {
ctx.setFillStyle(color);
ctx.setStrokeStyle(color);
} else {
switch (displayMode){
case DEFAULT:
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
break;
case SELECTED:
ctx.setFillStyle(color);
ctx.setStrokeStyle(color);
break;
case NOT_SELECTED:
ctx.setGlobalAlpha(BOAT_NOT_SELECTED_OPACITY);
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
break;
}
ctx.setLineWidth(1.0);
ctx.beginPath();
ctx.moveTo(2.4885714,1009.9999);
@@ -54,13 +64,24 @@ public class KeelBoatWithGennakerVectorGraphics extends BoatClassVectorGraphics
ctx.stroke();
//draw cockpit
if(displayMode == DisplayMode.SELECTED) {
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
} else {
ctx.setFillStyle(color);
switch (displayMode){
case DEFAULT:
ctx.setFillStyle (color);
ctx.setStrokeStyle(color);
break;
case SELECTED:
ctx.setFillStyle("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
break;
case NOT_SELECTED:
ctx.setGlobalAlpha(BOAT_NOT_SELECTED_OPACITY);
ctx.setFillStyle (color);
ctx.setStrokeStyle(color);
break;
}
ctx.setLineWidth(1.0);
ctx.beginPath();
ctx.moveTo(343.42857,966.99996);
@@ -13,12 +13,21 @@ public class LaserVectorGraphics extends BoatClassVectorGraphics {
@Override
protected void drawBoat(Context2d ctx, DisplayMode displayMode, String color) {
// outer part of the hull
if(displayMode == DisplayMode.SELECTED) {
ctx.setFillStyle(color);
ctx.setStrokeStyle(color);
} else {
switch (displayMode){
case DEFAULT:
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
break;
case SELECTED:
ctx.setFillStyle(color);
ctx.setStrokeStyle(color);
break;
case NOT_SELECTED:
ctx.setGlobalAlpha(BOAT_NOT_SELECTED_OPACITY);
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
break;
}
ctx.setLineWidth(2.0);
@@ -34,12 +43,21 @@ public class LaserVectorGraphics extends BoatClassVectorGraphics {
ctx.stroke();
// inner part of the hull
if(displayMode == DisplayMode.SELECTED) {
switch (displayMode){
case DEFAULT:
ctx.setFillStyle (color);
ctx.setStrokeStyle(color);
break;
case SELECTED:
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
} else {
ctx.setFillStyle(color);
break;
case NOT_SELECTED:
ctx.setGlobalAlpha(BOAT_NOT_SELECTED_OPACITY);
ctx.setFillStyle (color);
ctx.setStrokeStyle(color);
break;
}
ctx.setLineWidth(1.0);
@@ -14,12 +14,21 @@ public class SmallMultihullVectorGraphics extends BoatClassVectorGraphics {
@Override
protected void drawBoat(Context2d ctx, DisplayMode displayMode, String color) {
// outer net
if(displayMode == DisplayMode.SELECTED) {
ctx.setFillStyle(color);
ctx.setStrokeStyle(color);
} else {
switch (displayMode){
case DEFAULT:
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
break;
case SELECTED:
ctx.setFillStyle(color);
ctx.setStrokeStyle(color);
break;
case NOT_SELECTED:
ctx.setGlobalAlpha(BOAT_NOT_SELECTED_OPACITY);
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
break;
}
ctx.setLineWidth(1.0);
@@ -38,13 +47,23 @@ public class SmallMultihullVectorGraphics extends BoatClassVectorGraphics {
ctx.stroke();
// inner net
if(displayMode == DisplayMode.SELECTED) {
switch (displayMode){
case DEFAULT:
ctx.setFillStyle (color);
ctx.setStrokeStyle(color);
break;
case SELECTED:
ctx.setFillStyle("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
} else {
ctx.setFillStyle(color);
break;
case NOT_SELECTED:
ctx.setGlobalAlpha(BOAT_NOT_SELECTED_OPACITY);
ctx.setFillStyle (color);
ctx.setStrokeStyle(color);
break;
}
ctx.setLineWidth(1.0);
ctx.beginPath();
@@ -62,12 +81,21 @@ public class SmallMultihullVectorGraphics extends BoatClassVectorGraphics {
ctx.stroke();
// hull - left and right part
if(displayMode == DisplayMode.SELECTED) {
ctx.setFillStyle(color);
ctx.setStrokeStyle(color);
} else {
switch (displayMode){
case DEFAULT:
ctx.setFillStyle("#FFFFFF");
ctx.setStrokeStyle("#000000");
break;
case SELECTED:
ctx.setFillStyle(color);
ctx.setStrokeStyle(color);
break;
case NOT_SELECTED:
ctx.setGlobalAlpha(BOAT_NOT_SELECTED_OPACITY);
ctx.setFillStyle("#FFFFFF");
ctx.setStrokeStyle("#000000");
break;
}
ctx.setLineWidth(5.0);
@@ -13,12 +13,22 @@ public class _49erVectorGraphics extends BoatClassVectorGraphics {
@Override
protected void drawBoat(Context2d ctx, DisplayMode displayMode, String color) {
if(displayMode == DisplayMode.SELECTED) {
ctx.setFillStyle(color);
ctx.setStrokeStyle(color);
} else {
// draw hull
switch (displayMode){
case DEFAULT:
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
break;
case SELECTED:
ctx.setFillStyle (color);
ctx.setStrokeStyle(color);
break;
case NOT_SELECTED:
ctx.setGlobalAlpha(BOAT_NOT_SELECTED_OPACITY);
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
break;
}
ctx.setLineJoin(LineJoin.ROUND);
@@ -62,13 +72,21 @@ public class _49erVectorGraphics extends BoatClassVectorGraphics {
ctx.lineTo(226,68.5);
ctx.fill();
ctx.stroke();
if(displayMode == DisplayMode.SELECTED) {
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
} else {
switch (displayMode){
case DEFAULT:
ctx.setFillStyle(color);
ctx.setStrokeStyle(color);
break;
case SELECTED:
ctx.setFillStyle ("#FFFFFF");
ctx.setStrokeStyle("#FFFFFF");
break;
case NOT_SELECTED:
ctx.setGlobalAlpha(BOAT_NOT_SELECTED_OPACITY);
ctx.setFillStyle(color);
ctx.setStrokeStyle(color);
break;
}
ctx.beginPath();