diff --git a/gradle.properties b/gradle.properties index ff56deeb..6cb23cb5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=0.1.45 +version=0.1.46 android.enableBuildCache=true org.gradle.jvmargs=-Xmx1536M # android.enableAapt2=false diff --git a/renderer-test/src/main/java/armyc2/c2sd/renderer/test1/MainActivity.java b/renderer-test/src/main/java/armyc2/c2sd/renderer/test1/MainActivity.java index 622dcecf..dce580a0 100644 --- a/renderer-test/src/main/java/armyc2/c2sd/renderer/test1/MainActivity.java +++ b/renderer-test/src/main/java/armyc2/c2sd/renderer/test1/MainActivity.java @@ -261,7 +261,7 @@ public void drawSymbol(View view) outline.setStrokeWidth(1); //draw outline around symbol//////////////////////////////////////////////////////// //msCanvas.drawRect(ii.getSymbolBounds(), outline); - //msCanvas.drawRect(ii.getCenterPoint().x - 1, ii.getCenterPoint().y - 1, ii.getCenterPoint().x + 1, ii.getCenterPoint().y + 1, outline);//*/ + msCanvas.drawRect(ii.getCenterPoint().x - 1, ii.getCenterPoint().y - 1, ii.getCenterPoint().x + 1, ii.getCenterPoint().y + 1, outline);//*/ Log.i(TAG, "SymbolBounds: " + ii.getSymbolBounds().toString()); diff --git a/renderer/src/main/java/armyc2/c2sd/renderer/ModifierRenderer.java b/renderer/src/main/java/armyc2/c2sd/renderer/ModifierRenderer.java index 6f8ab595..3d52fa8b 100644 --- a/renderer/src/main/java/armyc2/c2sd/renderer/ModifierRenderer.java +++ b/renderer/src/main/java/armyc2/c2sd/renderer/ModifierRenderer.java @@ -1170,11 +1170,24 @@ private static Point[] createDOMArrowPoints(String symbolID, Rect bounds, Point Point pt2 = null; Point pt3 = null; + char affiliation = symbolID.charAt(1); int length = 40; if (SymbolUtilities.isNBC(symbolID)) { length = Math.round(bounds.height() / 2); } + else if((SymbolUtilities.isHQ(symbolID)) && + (affiliation==('F') || + affiliation==('A') || + affiliation==('D') || + affiliation==('M') || + affiliation==('J') || + affiliation==('K') || + affiliation==('N') || + affiliation==('L')) == false) + { + length = (int)Math.round(bounds.height() * 0.7); + } else { length = bounds.height(); @@ -1190,24 +1203,66 @@ private static Point[] createDOMArrowPoints(String symbolID, Rect bounds, Point pt1 = new Point(x1, y1); char scheme = symbolID.charAt(0); - if (SymbolUtilities.isNBC(symbolID) + if (SymbolUtilities.isHQ(symbolID)==false && SymbolUtilities.isNBC(symbolID) || (scheme == 'S' && symbolID.charAt(2) == ('G')) || scheme == 'O' || scheme == 'E') { - y1 = bounds.top + bounds.height(); - pt1 = new Point(x1, y1); - - if (isY == true && SymbolUtilities.isNBC(symbolID))//make room for y modifier + //drawStaff = true; + if(SymbolUtilities.isHQ(symbolID)==false)//has HQ staff to start from { - int yModifierOffset = (int) _modifierFontHeight; + y1 = bounds.top + bounds.height(); + pt1 = new Point(x1, y1); - yModifierOffset += RS.getTextOutlineWidth(); + if (isY == true && SymbolUtilities.isNBC(symbolID))//make room for y modifier + { + int yModifierOffset = (int) _modifierFontHeight; + + yModifierOffset += RS.getTextOutlineWidth(); + + pt1.offset(0, yModifierOffset); + } - pt1.offset(0, yModifierOffset); + y1 = y1 + length; + pt2 = new Point(x1, y1); } + else + { + x1 = bounds.left+1; + pt2 = new Point(x1, y1); + if(affiliation == 'F' || + affiliation == 'A' || + affiliation == 'D' || + affiliation == 'M' || + affiliation == 'J' || + affiliation == 'K' || + affiliation == 'N' || + affiliation == 'L') + { + /*y1 = bounds.top + bounds.height(); + pt1 = new Point(x1, y1); + y1 = y1 + length; + pt2 = new Point(x1, y1);//*/ + + pt1.x = x1; + y1 = bounds.top + (bounds.height()); + pt1.y = y1; + x2 = x1; + pt2.x = x2; + y1 = pt1.y + bounds.height(); + pt2.y = y1;//*/ - y1 = y1 + length; - pt2 = new Point(x1, y1); + } + else + { + pt1.x = x1; + y1 = bounds.top + (bounds.height() / 2); + pt1.y = y1; + x2 = x1; + pt2.x = x2; + y1 = pt1.y + bounds.height(); + pt2.y = y1; + } + } } //get endpoint given start point and an angle diff --git a/renderer/src/main/java/armyc2/c2sd/renderer/utilities/SymbolUtilities.java b/renderer/src/main/java/armyc2/c2sd/renderer/utilities/SymbolUtilities.java index dc980b7d..1d9b65f0 100644 --- a/renderer/src/main/java/armyc2/c2sd/renderer/utilities/SymbolUtilities.java +++ b/renderer/src/main/java/armyc2/c2sd/renderer/utilities/SymbolUtilities.java @@ -6,6 +6,7 @@ import java.text.SimpleDateFormat; import java.util.Date; +import java.util.Locale; import java.util.TimeZone; import java.util.logging.Level; import java.util.regex.Pattern; @@ -17,11 +18,10 @@ public class SymbolUtilities { - private static SimpleDateFormat dateFormatFront = new SimpleDateFormat("ddHHmmss"); - private static SimpleDateFormat dateFormatBack = new SimpleDateFormat("MMMyy"); - private static SimpleDateFormat dateFormatFull = new SimpleDateFormat("ddHHmmssZMMMyy"); - private static SimpleDateFormat dateFormatZulu = new SimpleDateFormat("Z"); - + private static SimpleDateFormat dateFormatFront = new SimpleDateFormat("ddHHmmss", Locale.US); + private static SimpleDateFormat dateFormatBack = new SimpleDateFormat("MMMyy", Locale.US); + private static SimpleDateFormat dateFormatFull = new SimpleDateFormat("ddHHmmssZMMMyy", Locale.US); + private static SimpleDateFormat dateFormatZulu = new SimpleDateFormat("Z", Locale.US); //this regex is from: https://docs.oracle.com/javase/7/docs/api/java/lang/Double.html private static final String Digits = "(\\p{Digit}+)";