001package armyc2.c5isr.renderer;
002
003import java.util.ArrayList;
004import java.util.List;
005import java.util.Locale;
006import java.util.Map;
007
008import android.graphics.Bitmap;
009import android.graphics.Canvas;
010import android.graphics.DashPathEffect;
011import android.graphics.Matrix;
012import android.graphics.Paint;
013import android.graphics.Path;
014import android.graphics.Point;
015import android.graphics.PointF;
016import android.graphics.Rect;
017import android.graphics.RectF;
018import android.graphics.Bitmap.Config;
019import android.graphics.Paint.Cap;
020import android.graphics.Paint.Join;
021import android.graphics.Paint.Style;
022import android.graphics.Path.Direction;
023import android.graphics.Typeface;
024
025import armyc2.c5isr.graphics2d.Point2D;
026import armyc2.c5isr.graphics2d.Rectangle2D;
027import armyc2.c5isr.renderer.utilities.Color;
028import armyc2.c5isr.renderer.utilities.ErrorLogger;
029import armyc2.c5isr.renderer.utilities.GENCLookup;
030import armyc2.c5isr.renderer.utilities.ImageInfo;
031import armyc2.c5isr.renderer.utilities.MSInfo;
032import armyc2.c5isr.renderer.utilities.MSLookup;
033import armyc2.c5isr.renderer.utilities.MilStdAttributes;
034import armyc2.c5isr.renderer.utilities.Modifier;
035import armyc2.c5isr.renderer.utilities.Modifiers;
036import armyc2.c5isr.renderer.utilities.PathUtilities;
037import armyc2.c5isr.renderer.utilities.RectUtilities;
038import armyc2.c5isr.renderer.utilities.RendererSettings;
039import armyc2.c5isr.renderer.utilities.RendererUtilities;
040import armyc2.c5isr.renderer.utilities.SVGInfo;
041import armyc2.c5isr.renderer.utilities.SVGLookup;
042import armyc2.c5isr.renderer.utilities.SVGPath;
043import armyc2.c5isr.renderer.utilities.SVGSymbolInfo;
044import armyc2.c5isr.renderer.utilities.Shape2SVG;
045import armyc2.c5isr.renderer.utilities.SymbolDimensionInfo;
046import armyc2.c5isr.renderer.utilities.SymbolID;
047import armyc2.c5isr.renderer.utilities.SymbolUtilities;
048import armyc2.c5isr.renderer.utilities.TextInfo;
049
050/**
051 * This class is used for rendering the labels/amplifiers/modifiers around the single point symbol.
052 */
053public class ModifierRenderer
054{
055
056    private static Paint _modifierFont = null;
057    private static float _modifierFontHeight = 10f;
058    private static float _modifierFontDescent = 2f;
059    private static RendererSettings RS = RendererSettings.getInstance();
060
061    private static final Object modifierFontMutex = new Object();
062    public static void setModifierFont(Paint font, float height, float descent)
063    {
064        synchronized (modifierFontMutex) {
065            _modifierFont = font;
066            _modifierFontHeight = height;
067            _modifierFontDescent = descent;
068        }
069    }
070
071    private static boolean hasPlannedCircle(String symbolID)
072    {
073        if(SymbolID.getVersion(symbolID)==SymbolID.Version_APP6Ech2 &&
074                SymbolID.getStatus(symbolID)==SymbolID.Status_Planned_Anticipated_Suspect &&
075                SymbolID.getSymbolSet(symbolID)==SymbolID.SymbolSet_ControlMeasure)
076        {
077            int ec = SymbolID.getEntityCode(symbolID);
078            switch (ec)
079            {
080                case 130400:
081                case 210700:
082                case 210800:
083                case 211000:
084                case 211100:
085                case 211200:
086                case 211400:
087                case 212000:
088                case 212100:
089                case 212200:
090                case 213000:
091                case 213100:
092                case 213200:
093                case 213300:
094                case 214900:
095                case 215000:
096                case 215100:
097                case 215200:
098                case 215300:
099                case 215400:
100                case 215500:
101                case 215600:
102                case 215700:
103                case 215800:
104                case 215900:
105                case 216000:
106                case 216100:
107                case 216200:
108                case 216300:
109                case 216400:
110                case 216500:
111                case 216600:
112                case 216700:
113                case 216800:
114                case 216900:
115                case 217000:
116                case 218000:
117                case 218100:
118                case 218200:
119                case 218300:
120                case 218500:
121                case 218600:
122                case 218700:
123                case 218900:
124                case 219100:
125                case 219200:
126                case 282001:
127                case 282002:
128                case 280900:
129                case 281000:
130                case 281100:
131                    return true;
132                default:
133                    return false;
134            }
135            //Check if it's a symbol that has this
136        }
137        return false;
138    }
139
140    /**
141     *
142     * @param bounds full image bounds of symbol so far
143     * @param symbolID 30 character string
144     * @return SVGSymbolInfo containing circle SVG string and its bounds
145     */
146    public static SVGSymbolInfo createPlannedCircle(RectF bounds, String symbolID)
147    {
148        if(!hasPlannedCircle(symbolID))
149            return null;
150
151        PointF offset = new PointF(RectUtilities.getCenterX(bounds) - 305.0f, RectUtilities.getCenterY(bounds) - 391.0f);
152
153        int cx = Math.round(305f);
154        int cy = Math.round(391f);
155        float cRadius = 150;
156        float cDiameter = cRadius*2;
157        int cstroke = 9;
158        float scale = 1;
159
160        if(bounds.height() > bounds.width())
161        {
162            scale = bounds.height() * 1.3f  / cDiameter;
163        }
164        else
165        {
166            scale = bounds.width() * 1.25f  / cDiameter;
167        }
168
169        String lineColor="#000000";
170
171        String transform = " transform=\"translate(" + (cx) + "," + (cy) + ") scale(" + scale + ") translate(" + -(cx) + "," + -(cy) + ")\"";
172
173        StringBuilder svg = new StringBuilder();
174        svg.append("<circle cx=\"").append(cx).append("\" cy=\"").append(cy).append("\" r=\"").append(cRadius).append("\" fill=\"none\" stroke=\"white\" stroke-width=\"").append(cstroke-2).append("\"");
175        svg.append(transform);
176        svg.append("/>");
177        svg.append("<circle cx=\"").append(cx).append("\" cy=\"").append(cy).append("\" r=\"").append(cRadius).append("\" fill=\"none\" stroke=\"").append(lineColor).append("\" stroke-width=\"").append(cstroke).append("\"");
178        svg.append(" stroke-dasharray=\"2,11,14,11,85,11,14,11,151,11,14,11,90,11,14,11,90,11,14,11,90,11,14,11,90,11,14,11,105\"");
179        svg.append(transform);
180        svg.append("/>");
181
182        svg.insert(0,"<g " + "transform=\"translate(" + offset.x + "," + offset.y + ")\">");
183        svg.append("</g>");
184
185        float radius = (float)Math.ceil((cRadius + (cstroke/2f)) * scale);
186
187        RectF cBounds = RectUtilities.makeRectF(RectUtilities.getCenterX(bounds) - radius, RectUtilities.getCenterY(bounds) - radius, radius*2, radius*2);
188
189        //SVGSymbolInfo(String svg, Point anchorPoint, Rect symbolBounds, Rect svgBounds)
190        return new SVGSymbolInfo(svg.toString(),new PointF(Math.round(RectUtilities.getCenterX(bounds)),Math.round(RectUtilities.getCenterY(bounds))),bounds,cBounds);
191        /*
192          <circle cx="305" cy="391" r="150" fill="none" stroke="white" stroke-width="7" />
193            <circle cx="305" cy="391" r="150" fill="none" stroke="black" stroke-width="9"
194        stroke-dasharray="2,11,14,11,85,11,14,11,151,11,14,11,90,11,14,11,90,11,14,11,90,11,14,11,90,11,14,11,105"
195        stroke-dashoffset="0" transform="matrix(1.5, 0, 0, 1.5, -152.5, -195.5)"
196            />*/
197    }
198
199    public static SymbolDimensionInfo processUnitDisplayModifiers(SymbolDimensionInfo sdi, String symbolID, Map<String,String> modifiers, Boolean hasTextModifiers, Map<String,String> attributes)
200    {
201
202        ImageInfo ii = null;
203        ImageInfo newii = null;
204        SVGSymbolInfo ssi = null;
205        SymbolDimensionInfo newsdi = null;
206        Rect symbolBounds = new Rect(sdi.getSymbolBounds());
207        Rect imageBounds = new Rect(sdi.getImageBounds());
208        Point centerPoint = new Point(sdi.getCenterPoint());
209        Point symbolCenter = new Point(symbolBounds.centerX(), symbolBounds.centerY());
210        TextInfo tiEchelon = null;
211        TextInfo tiAM = null;
212        Rect echelonBounds = null;
213        Rect amBounds = null;
214        Color textColor = Color.BLACK;
215        Color textBackgroundColor = null;
216        float strokeWidth = 3.0f;
217        float strokeWidthNL = 3.0f;
218        Color lineColor = SymbolUtilities.getLineColorOfAffiliation(symbolID);
219        Color fillColor = SymbolUtilities.getFillColorOfAffiliation(symbolID);
220        int buffer = 0;
221        int alpha = 255;
222        //ctx = null;
223        int offsetX = 0;
224        int offsetY = 0;
225        int pixelSize = RendererSettings.getInstance().getDefaultPixelSize();
226        SVGPath svgMobilityPath = null;
227        String svgMobilityGroup = null;
228
229        Paint modifierFont = getFont(attributes);
230        float[] hd = getFontHeightandDescent(modifierFont);
231        float modifierFontHeight = hd[0];
232        float modifierFontDescent = hd[1];
233
234        String modifierFontName = RendererSettings.getInstance().getModiferFontProps()[0];
235        if(attributes != null && attributes.containsKey(MilStdAttributes.FontFamily))
236        {
237            String temp = attributes.get(MilStdAttributes.FontFamily);
238            if(temp != null && !temp.isEmpty())
239                modifierFontName = temp;
240        }
241
242        int ss = SymbolID.getSymbolSet(symbolID);
243
244        if (attributes.containsKey(MilStdAttributes.Alpha))
245        {
246            alpha = Integer.parseInt(attributes.get(MilStdAttributes.Alpha));
247            textColor.setAlpha(alpha);
248        }
249        if (attributes.containsKey(MilStdAttributes.TextColor))
250        {
251            textColor = RendererUtilities.getColorFromHexString(attributes.get(MilStdAttributes.TextColor));
252            if(alpha > -1)
253                textColor.setAlpha(alpha);
254        }
255        if (attributes.containsKey(MilStdAttributes.TextBackgroundColor))
256        {
257            textBackgroundColor = RendererUtilities.getColorFromHexString(attributes.get(MilStdAttributes.TextBackgroundColor));
258            if(alpha > -1)
259                textBackgroundColor.setAlpha(alpha);
260        }
261        if (attributes.containsKey(MilStdAttributes.LineColor))
262        {
263            lineColor = RendererUtilities.getColorFromHexString(attributes.get(MilStdAttributes.LineColor));
264        }
265        if (attributes.containsKey(MilStdAttributes.FillColor))
266        {
267            fillColor = RendererUtilities.getColorFromHexString(attributes.get(MilStdAttributes.FillColor));
268        }
269        if(attributes.containsKey(MilStdAttributes.PixelSize))
270        {
271            pixelSize = Integer.parseInt(attributes.get(MilStdAttributes.PixelSize));
272        }
273
274        //float fontsize = RendererSettings.getInstance().getModiferFont().getTextSize();
275
276        // <editor-fold defaultstate="collapsed" desc="Build Mobility Modifiers">
277        float strokeWidthBasedOnDPI = 1;//min//Math.max(RendererSettings.getInstance().getDeviceDPI()/210,1);//min DPI
278        strokeWidthBasedOnDPI = Math.max(pixelSize / 25f,strokeWidthBasedOnDPI);//dpi base on symbol size
279        strokeWidthBasedOnDPI = Math.min(strokeWidthBasedOnDPI,RendererSettings.getInstance().getDeviceDPI()/32f);//max dpi
280
281        RectF mobilityBounds = null;
282        int ad = SymbolID.getAmplifierDescriptor(symbolID);//echelon/mobility
283        List<Path> shapes = new ArrayList<Path>();
284        Path mobilityPath = null;
285        Path mobilityPathFill = null;
286        if (ad >= SymbolID.Mobility_WheeledLimitedCrossCountry &&
287                (SymbolUtilities.canSymbolHaveModifier(symbolID, Modifiers.R_MOBILITY_INDICATOR) ||
288                 SymbolUtilities.canSymbolHaveModifier(symbolID, Modifiers.AG_AUX_EQUIP_INDICATOR)))
289        {
290
291            //Draw Mobility
292            int fifth = (int) ((symbolBounds.width() * 0.2) + 0.5f);
293            mobilityPath = new Path();
294            svgMobilityPath = null;
295            svgMobilityGroup = null;
296
297            int x = 0;
298            int y = 0;
299            int centerX = 0;
300            int bottomY = 0;
301            int height = 0;
302            int width = 0;
303            int middleY = 0;
304            int wheelOffset = 2;
305            int wheelSize = fifth;//10;
306            int rrHeight = fifth;//10;
307            int rrArcWidth = (int) ((fifth * 1.5) + 0.5f);//16;
308            float rad = wheelSize/2;
309
310
311            x = (int) symbolBounds.left + 1;
312            y = (int) symbolBounds.top;
313            height = Math.round(symbolBounds.height());
314            width = Math.round(symbolBounds.width()) - 3;
315            bottomY = y + height + 2;
316
317
318
319            if (ad >= SymbolID.Mobility_WheeledLimitedCrossCountry && //31, mobility starts above 30
320                    SymbolUtilities.canSymbolHaveModifier(symbolID, Modifiers.R_MOBILITY_INDICATOR))
321            {
322                bottomY = y + height + 2;
323
324                //wheelSize = width / 7;
325                //rrHeight = width / 7;
326                //rrArcWidth = width / 7;
327                if (ad == SymbolID.Mobility_WheeledLimitedCrossCountry)
328                {
329                    //line
330                    PathUtilities.addLine(mobilityPath, x, bottomY, x + width, bottomY);
331
332                    //left circle
333                    PathUtilities.addEllipse(mobilityPath, x, bottomY + wheelOffset, wheelSize, wheelSize);
334
335                    //right circle
336                    PathUtilities.addEllipse(mobilityPath, x + width - wheelSize, bottomY + wheelOffset, wheelSize, wheelSize);
337
338                    //SVG
339                    svgMobilityGroup = "<line x1=\"" + x + "\" y1=\"" + bottomY + "\" x2=\"" + (x + width) + "\" y2=\"" + bottomY + "\" />\n";
340                    svgMobilityGroup += "<circle cx=\"" + (x + (wheelSize/2)) + "\" cy=\"" + (bottomY + wheelOffset + (wheelSize/2)) + "\" r=\"" + (wheelSize/2) + "\"  ></circle>\n";
341                    svgMobilityGroup += "<circle cx=\"" + (x + width - (wheelSize/2)) + "\" cy=\"" + (bottomY + wheelOffset + (wheelSize/2)) + "\" r=\"" + (wheelSize/2) + "\"  ></circle>\n";
342                }
343                else if (ad == SymbolID.Mobility_WheeledCrossCountry)
344                {
345                    //line
346                    PathUtilities.addLine(mobilityPath, x, bottomY, x + width, bottomY);
347
348                    //left circle
349                    PathUtilities.addEllipse(mobilityPath, x, bottomY + wheelOffset, wheelSize, wheelSize);
350
351                    //right circle
352                    PathUtilities.addEllipse(mobilityPath, x + width - wheelSize, bottomY + wheelOffset, wheelSize, wheelSize);
353
354                    //center wheel
355                    PathUtilities.addEllipse(mobilityPath, x + (width / 2) - (wheelSize / 2), bottomY + wheelOffset, wheelSize, wheelSize);
356
357                    //SVG
358                    svgMobilityGroup = "<line x1=\"" + x + "\" y1=\"" + bottomY + "\" x2=\"" + (x + width) + "\" y2=\"" + bottomY + "\" />\n";
359                    svgMobilityGroup += "<circle cx=\"" + (x + (wheelSize/2)) + "\" cy=\"" + (bottomY + wheelOffset + (wheelSize/2)) + "\" r=\"" + (wheelSize/2) + "\" stroke=\"black\" ></circle>\n";
360                    svgMobilityGroup += "<circle cx=\"" + (x + width - (wheelSize/2)) + "\" cy=\"" + (bottomY + wheelOffset + (wheelSize/2)) + "\" r=\"" + (wheelSize/2) + "\" stroke=\"black\" ></circle>\n";
361                    svgMobilityGroup += "<circle cx=\"" + (x + (width/2)) + "\" cy=\"" + (bottomY + wheelOffset + (wheelSize/2)) + "\" r=\"" + (wheelSize/2) + "\" stroke=\"black\" ></circle>\n";
362                }
363                else if (ad == SymbolID.Mobility_Tracked)
364                {
365                    //round rectangle
366                    PathUtilities.addRoundedRect(mobilityPath, x, bottomY, width, rrHeight, rrHeight/2, rrHeight);
367                    svgMobilityGroup = "<rect width=\"" + width + "\" height=\"" + rrHeight + "\" x=\"" + x + "\" y=\"" + bottomY + "\" rx=\"" + rrHeight/2 + "\" ry=\"" + rrHeight + "\" />\n";
368
369                }
370                else if (ad == SymbolID.Mobility_Wheeled_Tracked)
371                {
372                    //round rectangle
373                    PathUtilities.addRoundedRect(mobilityPath, x, bottomY, width, rrHeight, wheelSize/2, rrHeight);
374                    svgMobilityGroup = "<rect width=\"" + width + "\" height=\"" + rrHeight + "\" x=\"" + x + "\" y=\"" + bottomY + "\" rx=\"" + rrHeight/2 + "\" ry=\"" + rrHeight + "\" />\n";
375
376                    //left circle
377                    PathUtilities.addEllipse(mobilityPath, x - wheelSize - wheelSize, bottomY, wheelSize, wheelSize);
378                    svgMobilityGroup += "<circle cx=\"" + (x - wheelSize - wheelSize/2) + "\" cy=\"" + (bottomY + (wheelSize/2)) + "\" r=\"" + (wheelSize/2) + "\"  stroke=\"black\" ></circle>\n";
379                }
380                else if (ad == SymbolID.Mobility_Towed)
381                {
382                    //line
383                    PathUtilities.addLine(mobilityPath, x + wheelSize, bottomY + (wheelSize / 2),
384                            x + width - wheelSize, bottomY + (wheelSize / 2));
385
386                    //left circle
387                    PathUtilities.addEllipse(mobilityPath, x, bottomY, wheelSize, wheelSize);
388
389                    //right circle
390                    PathUtilities.addEllipse(mobilityPath, x + width - wheelSize, bottomY, wheelSize, wheelSize);
391
392                    //SVG
393                    svgMobilityGroup = "<line x1=\"" + (x + wheelSize) + "\" y1=\"" + (bottomY + (wheelSize/2) + "\" x2=\"" + (x + width - wheelSize) + "\" y2=\"" + (bottomY + (wheelSize/2))) + "\" />\n";
394                    svgMobilityGroup += "<circle cx=\"" + (x + (wheelSize/2)) + "\" cy=\"" + (bottomY + (wheelSize/2)) + "\" r=\"" + (wheelSize/2) + "\" fill=\"none\" stroke=\"black\" ></circle>\n";
395                    svgMobilityGroup += "<circle cx=\"" + (x + width - (wheelSize/2)) + "\" cy=\"" + (bottomY + (wheelSize/2)) + "\" r=\"" + (wheelSize/2) + "\" fill=\"none\" stroke=\"black\" ></circle>\n";
396                }
397                else if (ad == SymbolID.Mobility_Rail)
398                {
399                    //line
400                    PathUtilities.addLine(mobilityPath, x, bottomY, x + width, bottomY);
401
402                    //left circle
403                    PathUtilities.addEllipse(mobilityPath, x + wheelSize, bottomY + wheelOffset, wheelSize, wheelSize);
404
405                    //left circle2
406                    PathUtilities.addEllipse(mobilityPath, x, bottomY + wheelOffset, wheelSize, wheelSize);
407
408                    //right circle
409                    PathUtilities.addEllipse(mobilityPath, x + width - wheelSize, bottomY + wheelOffset, wheelSize, wheelSize);
410
411                    //right circle2
412                    PathUtilities.addEllipse(mobilityPath, x + width - wheelSize - wheelSize, bottomY + wheelOffset, wheelSize, wheelSize);
413
414                    //SVG
415                    svgMobilityGroup = "<line x1=\"" + x + "\" y1=\"" + bottomY + "\" x2=\"" + (x + width) + "\" y2=\"" + bottomY + "\" />\n";
416
417                    svgMobilityGroup += "<circle cx=\"" + (x + rad) + "\" cy=\"" + (bottomY + wheelOffset + rad) + "\" r=\"" + rad + "\" ></circle>\n";
418                    svgMobilityGroup += "<circle cx=\"" + (x + rad + wheelSize) + "\" cy=\"" + (bottomY + wheelOffset + rad) + "\" r=\"" + rad + "\" ></circle>\n";
419
420                    svgMobilityGroup += "<circle cx=\"" + (x + width - rad) + "\" cy=\"" + (bottomY + wheelOffset + rad) + "\" r=\"" + rad + "\" ></circle>\n";
421                    svgMobilityGroup += "<circle cx=\"" + (x + width - rad - wheelSize) + "\" cy=\"" + (bottomY + wheelOffset + rad) + "\" r=\"" + rad + "\" ></circle>\n";
422
423                }
424                else if (ad == SymbolID.Mobility_OverSnow)
425                {
426                        float halfWidth = (rrArcWidth * 0.5f);
427                    mobilityPath.moveTo(x, bottomY);
428                    mobilityPath.lineTo(x + halfWidth, bottomY + halfWidth);
429                    mobilityPath.lineTo(x + width, bottomY + halfWidth);
430
431                    //SVG
432                    svgMobilityPath = new SVGPath();
433                    svgMobilityPath.moveTo(x,bottomY);
434                    svgMobilityPath.lineTo(x + halfWidth, bottomY + halfWidth);
435                    svgMobilityPath.lineTo(x + width, bottomY + halfWidth);
436
437                }
438                else if (ad == SymbolID.Mobility_Sled)
439                {
440                    mobilityPath.moveTo(x, bottomY);
441
442                    mobilityPath.cubicTo(x, bottomY, x - rrHeight, bottomY + rrHeight/2, x, bottomY + rrHeight);
443                    //mobilityPath.bezierCurveTo(x, bottomY, x-rrArcWidth, bottomY+3, x, bottomY+rrHeight);
444
445                    mobilityPath.lineTo(x + width, bottomY + rrHeight);
446
447                    mobilityPath.cubicTo(x + width, bottomY + rrHeight, x + width + rrHeight, bottomY + rrHeight/2, x + width, bottomY);
448                    //shapeMobility.curveTo(x + width, bottomY + rrHeight, x+ width + rrArcWidth, bottomY+3, x + width, bottomY);
449
450                    //SVG
451                    svgMobilityPath = new SVGPath();
452                    svgMobilityPath.moveTo(x, bottomY);
453                    svgMobilityPath.bezierCurveTo(x, bottomY, x - rrHeight, bottomY + rrHeight/2, x, bottomY + rrHeight);
454                    svgMobilityPath.lineTo(x + width, bottomY + rrHeight);
455                    svgMobilityPath.bezierCurveTo(x + width, bottomY + rrHeight, x + width + rrHeight, bottomY + rrHeight/2, x + width, bottomY);
456
457                }
458                else if (ad == SymbolID.Mobility_PackAnimals)
459                {
460                    centerX = Math.round(RectUtilities.getCenterX(symbolBounds));
461                    int angleWidth = rrHeight / 2;
462                    mobilityPath.moveTo(centerX, bottomY + rrHeight + 2);
463                    mobilityPath.lineTo(centerX - angleWidth, bottomY);
464                    mobilityPath.lineTo(centerX - angleWidth*2, bottomY + rrHeight + 2);
465
466                    mobilityPath.moveTo(centerX, bottomY + rrHeight + 2);
467                    mobilityPath.lineTo(centerX + angleWidth, bottomY);
468                    mobilityPath.lineTo(centerX + angleWidth*2, bottomY + rrHeight + 2);
469
470                    //SVG
471                    svgMobilityPath = new SVGPath();
472                    svgMobilityPath.moveTo(centerX, bottomY + rrHeight + 2);
473                    svgMobilityPath.lineTo(centerX - angleWidth, bottomY);
474                    svgMobilityPath.lineTo(centerX - angleWidth*2, bottomY + rrHeight + 2);
475
476                    svgMobilityPath.moveTo(centerX, bottomY + rrHeight + 2);
477                    svgMobilityPath.lineTo(centerX + angleWidth, bottomY);
478                    svgMobilityPath.lineTo(centerX + angleWidth*2, bottomY + rrHeight + 2);
479                }
480                else if (ad == SymbolID.Mobility_Barge)
481                {
482                    centerX = Math.round(RectUtilities.getCenterX(symbolBounds));
483                    PathUtilities.addLine(mobilityPath, x + width, bottomY, x, bottomY);
484                    //var line = new SO.Line(x + width, bottomY,x, bottomY);
485
486                    float quarterX = (centerX - x) / 2;
487                    //var quarterY = (((bottomY + rrHeight) - bottomY)/2);
488
489                    mobilityPath.moveTo(x, bottomY);
490                    mobilityPath.cubicTo(x + quarterX, bottomY + rrHeight, centerX + quarterX, bottomY + rrHeight, x + width, bottomY);
491                    //shapes.push(new SO.BCurve(x, bottomY,x+quarterX, bottomY+rrHeight, centerX + quarterX, bottomY + rrHeight, x + width, bottomY));
492
493                    //SVG
494                    svgMobilityPath = new SVGPath();
495                    svgMobilityPath.moveTo(x + width, bottomY);
496                    svgMobilityPath.lineTo(x, bottomY);
497                    svgMobilityPath.moveTo(x, bottomY);
498                    svgMobilityPath.bezierCurveTo(x + quarterX, bottomY + rrHeight, centerX + quarterX, bottomY + rrHeight, x + width, bottomY);
499                }
500
501                else if (ad == SymbolID.Mobility_Amphibious)
502                {
503                    float incrementX = width / 7;
504                    middleY = (bottomY + (rrHeight / 2));
505
506                    x = Math.round(x + (incrementX / 2));
507                    float r = Math.round(incrementX / 2);
508
509                    //mobilityPath.arcTo(oval, sAngle, sAngle, moveTo);
510                    PathUtilities.arc(mobilityPath, x, middleY, r, 180, 180);
511                    PathUtilities.arc(mobilityPath, x + incrementX, middleY, r, 180, -180, false);
512                    PathUtilities.arc(mobilityPath, x + incrementX * 2, middleY, r, 180, 180, false);
513                    PathUtilities.arc(mobilityPath, x + incrementX * 3, middleY, r, 180, -180, false);
514                    PathUtilities.arc(mobilityPath, x + incrementX * 4, middleY, r, 180, 180, false);
515                    PathUtilities.arc(mobilityPath, x + incrementX * 5, middleY, r, 180, -180, false);
516                    PathUtilities.arc(mobilityPath, x + incrementX * 6, middleY, r, 180, 180, false);
517
518                    //SVG
519                    x = symbolBounds.left + 1;
520                    svgMobilityGroup = "<path d=\"M" + x + " " + middleY + " ";
521                    svgMobilityGroup += "C " + x + " " + bottomY + " " + (x + incrementX) + " " + bottomY + " " + (x + incrementX) + " " + middleY + " ";
522                    svgMobilityGroup += "C " + (x + incrementX) + " " + (bottomY + rrHeight) + " " + (x + (incrementX * 2)) + " " + (bottomY + rrHeight) + " " + (x + (incrementX*2)) + " " + middleY + " ";
523                    svgMobilityGroup += "C " + (x + (incrementX*2))  + " " + bottomY + " " + (x + (incrementX*3)) + " " + bottomY + " " + (x + incrementX*3) + " " + middleY + " ";
524                    svgMobilityGroup += "C " + (x + (incrementX*3)) + " " + (bottomY + rrHeight) + " " + (x + (incrementX * 4)) + " " + (bottomY + rrHeight) + " " + (x + (incrementX*4)) + " " + middleY + " ";
525                    svgMobilityGroup += "C " + (x + (incrementX*4))  + " " + bottomY + " " + (x + (incrementX*5)) + " " + bottomY + " " + (x + incrementX*5) + " " + middleY + " ";
526                    svgMobilityGroup += "C " + (x + (incrementX*5)) + " " + (bottomY + rrHeight) + " " + (x + (incrementX * 6)) + " " + (bottomY + rrHeight) + " " + (x + (incrementX*6)) + " " + middleY + " ";
527                    svgMobilityGroup += "C " + (x + (incrementX*6))  + " " + bottomY + " " + (x + (incrementX*7)) + " " + bottomY + " " + (x + incrementX*7) + " " + middleY + " ";
528                    svgMobilityGroup += "\"/>";
529
530
531                }
532
533                if(svgMobilityGroup != null)
534                    svgMobilityGroup = "<g stroke-width=\"" + strokeWidthBasedOnDPI + "\" fill=\"none\"" + " stroke=\"" + RendererUtilities.colorToHexString(lineColor,false) + "\"" + ">\n" + svgMobilityGroup + "</g>\n";
535
536            }
537            //Draw Towed Array Sonar
538            if ((ad == SymbolID.Mobility_ShortTowedArray || ad == SymbolID.Mobility_LongTowedArray) &&
539                    SymbolUtilities.canSymbolHaveModifier(symbolID, Modifiers.AG_AUX_EQUIP_INDICATOR)) {
540                int boxHeight = (int) ((rrHeight * 0.8f) + 0.5f);
541                bottomY = y + height + (boxHeight / 7);
542                mobilityPathFill = new Path();
543                offsetY = boxHeight / 7;//1;
544                centerX = Math.round(symbolBounds.left + (symbolBounds.right - symbolBounds.left) / 2);
545                int squareOffset = Math.round(boxHeight * 0.5f);
546                middleY = ((boxHeight / 2) + bottomY) + offsetY;//+1 for offset from symbol
547                if (ad == SymbolID.Mobility_ShortTowedArray) {
548                    //subtract 0.5 because lines 1 pixel thick get aliased into
549                    //a line two pixels wide.
550                    //line
551                    PathUtilities.addLine(mobilityPath, centerX - 1, bottomY - 1, centerX - 1, bottomY + offsetY + boxHeight + offsetY);
552                    //shapes.push(new SO.Line(centerX-1,bottomY-1,centerX-1, bottomY + rrHeight + 3));
553                    //shapeLines.append(new Line2D.Double(centerX,bottomY - 2,centerX, bottomY + rrHeight + 1), false);
554                    //line
555                    PathUtilities.addLine(mobilityPath, x, middleY, x + width, middleY);
556                    //shapes.push(new SO.Line(x,middleY,x + width, middleY));
557                    //shapeLines.append(new Line2D.Double(x,middleY,x + width, middleY), false);
558                    //square
559                    mobilityPathFill.addRect(PathUtilities.makeRectF(x - squareOffset, bottomY + offsetY, boxHeight, boxHeight), Direction.CW);
560                    //shapes.push(new SO.Rectangle(x-squareOffset, bottomY+offsetY, 5, 5));
561                    //shapeSquares.append(new Rectangle2D.Double(x-squareOffset, bottomY, 5, 5), false);
562                    //square
563                    mobilityPathFill.addRect(PathUtilities.makeRectF(Math.round(centerX - squareOffset), bottomY + offsetY, boxHeight, boxHeight), Direction.CW);
564                    //shapes.push(new SO.Rectangle(Math.round(centerX-squareOffset), bottomY+offsetY, 5, 5));
565                    //shapeSquares.append(new Rectangle2D.Double(centerX-squareOffset, bottomY, 5, 5), false);
566                    //square
567                    mobilityPathFill.addRect(PathUtilities.makeRectF(x + width - squareOffset, bottomY + offsetY, boxHeight, boxHeight), Direction.CW);
568                    //shapes.push(new SO.Rectangle(x + width - squareOffset, bottomY+offsetY, 5, 5));
569                    //shapeSquares.append(new Rectangle2D.Double(x + width - squareOffset, bottomY, 5, 5), false);
570
571                    //SVG
572                    String svgColor = RendererUtilities.colorToHexString(lineColor,false);
573                    svgMobilityGroup = "<line x1=\"" + (centerX - 1) + "\" y1=\"" + (bottomY - 1) + "\" x2=\"" + (centerX - 1) + "\" y2=\"" + (bottomY + offsetY + boxHeight + offsetY) + "\" stroke=\"" + svgColor + "\" stroke-width=\"" + strokeWidthBasedOnDPI + "\" />\n";
574                    svgMobilityGroup += "<line x1=\"" + (x) + "\" y1=\"" + (middleY) + "\" x2=\"" + (x + width) + "\" y2=\"" + (middleY) + "\" stroke=\"" + svgColor + "\" stroke-width=\"" + strokeWidthBasedOnDPI + "\" />\n";
575                    svgMobilityGroup += "<rect width=\"" + (boxHeight) + "\" height=\"" + (boxHeight) + "\" x=\"" + (x - squareOffset) + "\" y=\"" + (bottomY + offsetY) + "\" fill=\"" + svgColor + "\" stroke-width=\"0\"/>\n";
576                    svgMobilityGroup += "<rect width=\"" + (boxHeight) + "\" height=\"" + (boxHeight) + "\" x=\"" + (centerX - squareOffset) + "\" y=\"" + (bottomY + offsetY) + "\" fill=\"" + svgColor + "\" stroke-width=\"0\"/>\n";
577                    svgMobilityGroup += "<rect width=\"" + (boxHeight) + "\" height=\"" + (boxHeight) + "\" x=\"" + (x + width - squareOffset) + "\" y=\"" + (bottomY + offsetY) + "\" fill=\"" + svgColor + "\" stroke-width=\"0\"/>\n";
578
579
580                } else if (ad == SymbolID.Mobility_LongTowedArray) {
581                    int leftX = x + (centerX - x) / 2,
582                            rightX = centerX + (x + width - centerX) / 2;
583
584                    //line vertical left
585                    PathUtilities.addLine(mobilityPath, leftX, bottomY - 1, leftX, bottomY + offsetY + boxHeight + offsetY);
586                    //shapes.push(new SO.Line(leftX,bottomY - 1,leftX, bottomY + rrHeight + 3));
587                    //shapeLines.append(new Line2D.Double(leftX,bottomY - 2,leftX, bottomY + rrHeight + 1), false);
588                    //line vertical right
589                    PathUtilities.addLine(mobilityPath, rightX, bottomY - 1, rightX, bottomY + offsetY + boxHeight + offsetY);
590                    //shapes.push(new SO.Line(rightX,bottomY - 1,rightX, bottomY + rrHeight + 3));
591                    //shapeLines.append(new Line2D.Double(rightX,bottomY - 2,rightX, bottomY + rrHeight + 1), false);
592                    //line horizontal
593                    PathUtilities.addLine(mobilityPath, x, middleY, x + width, middleY);
594                    //shapes.push(new SO.Line(x,middleY,x + width, middleY));
595                    //shapeLines.append(new Line2D.Double(x,middleY,x + width, middleY), false);
596                    //square left
597                    mobilityPathFill.addRect(PathUtilities.makeRectF(x - squareOffset, bottomY + offsetY, boxHeight, boxHeight), Direction.CW);
598                    //shapes.push(new SO.Rectangle(x-squareOffset, bottomY+offsetY, 5, 5));
599                    //shapeSquares.append(new Rectangle2D.Double(x-squareOffset, bottomY, 5, 5), false);
600                    //square middle
601                    mobilityPathFill.addRect(PathUtilities.makeRectF(centerX - squareOffset, bottomY + offsetY, boxHeight, boxHeight), Direction.CW);
602                    //shapes.push(new SO.Rectangle(centerX-squareOffset, bottomY+offsetY, 5, 5));
603                    //shapeSquares.append(new Rectangle2D.Double(centerX-squareOffset, bottomY, 5, 5), false);
604                    //square right
605                    mobilityPathFill.addRect(PathUtilities.makeRectF(x + width - squareOffset, bottomY + offsetY, boxHeight, boxHeight), Direction.CW);
606                    //shapes.push(new SO.Rectangle(x + width - squareOffset, bottomY+offsetY, 5, 5));
607                    //shapeSquares.append(new Rectangle2D.Double(x + width - squareOffset, bottomY, 5, 5), false);
608                    //square middle left
609                    mobilityPathFill.addRect(PathUtilities.makeRectF(leftX - squareOffset, bottomY + offsetY, boxHeight, boxHeight), Direction.CW);
610                    //shapes.push(new SO.Rectangle(leftX - squareOffset, bottomY+offsetY, 5, 5));
611                    //shapeSquares.append(new Rectangle2D.Double(leftX - squareOffset, bottomY, 5, 5), false);
612                    //square middle right
613                    mobilityPathFill.addRect(PathUtilities.makeRectF(rightX - squareOffset, bottomY + offsetY, boxHeight, boxHeight), Direction.CW);
614                    //shapes.push(new SO.Rectangle(rightX - squareOffset, bottomY+offsetY, 5, 5));
615                    //shapeSquares.append(new Rectangle2D.Double(rightX - squareOffset, bottomY, 5, 5), false);
616
617                    //SVG
618                    String svgColor = RendererUtilities.colorToHexString(lineColor,false);
619                    svgMobilityGroup = "<line x1=\"" + (leftX) + "\" y1=\"" + (bottomY - 1) + "\" x2=\"" + (leftX) + "\" y2=\"" + (bottomY + offsetY + boxHeight + offsetY) + "\" stroke=\"" + svgColor + "\" stroke-width=\"" + strokeWidthBasedOnDPI + "\" />\n";
620                    svgMobilityGroup += "<line x1=\"" + (rightX) + "\" y1=\"" + (bottomY - 1) + "\" x2=\"" + (rightX) + "\" y2=\"" + (bottomY + offsetY + boxHeight + offsetY) + "\" stroke=\"" + svgColor + "\" stroke-width=\"" + strokeWidthBasedOnDPI + "\" />\n";
621                    svgMobilityGroup += "<line x1=\"" + (x) + "\" y1=\"" + (middleY) + "\" x2=\"" + (x + width) + "\" y2=\"" + (middleY) + "\" stroke=\"" + svgColor + "\" stroke-width=\"" + strokeWidthBasedOnDPI + "\" />\n";
622                    svgMobilityGroup += "<rect width=\"" + (boxHeight) + "\" height=\"" + (boxHeight) + "\" x=\"" + (x - squareOffset) + "\" y=\"" + (bottomY + offsetY) + "\" fill=\"" + svgColor + "\" stroke-width=\"0\"/>\n";
623                    svgMobilityGroup += "<rect width=\"" + (boxHeight) + "\" height=\"" + (boxHeight) + "\" x=\"" + (centerX - squareOffset) + "\" y=\"" + (bottomY + offsetY) + "\" fill=\"" + svgColor + "\" stroke-width=\"0\"/>\n";
624                    svgMobilityGroup += "<rect width=\"" + (boxHeight) + "\" height=\"" + (boxHeight) + "\" x=\"" + (x + width - squareOffset) + "\" y=\"" + (bottomY + offsetY) + "\" fill=\"" + svgColor + "\" stroke-width=\"0\"/>\n";
625                    svgMobilityGroup += "<rect width=\"" + (boxHeight) + "\" height=\"" + (boxHeight) + "\" x=\"" + (leftX - squareOffset) + "\" y=\"" + (bottomY + offsetY) + "\" fill=\"" + svgColor + "\" stroke-width=\"0\"/>\n";
626                    svgMobilityGroup += "<rect width=\"" + (boxHeight) + "\" height=\"" + (boxHeight) + "\" x=\"" + (rightX - squareOffset) + "\" y=\"" + (bottomY + offsetY) + "\" fill=\"" + svgColor + "\" stroke-width=\"0\"/>\n";
627
628                }
629                if(svgMobilityGroup != null)
630                    svgMobilityGroup = "<g stroke-width=\"" + strokeWidthBasedOnDPI + "\" fill=\"" + RendererUtilities.colorToHexString(lineColor,false) + "\"" + " stroke=\"" + RendererUtilities.colorToHexString(lineColor,false) + "\"" +  ">\n" + svgMobilityGroup + "\n</g>";
631            }
632
633            //get mobility bounds
634            if (mobilityPath != null)
635            {
636
637                //build mobility bounds
638                mobilityBounds = new RectF();
639                mobilityPath.computeBounds(mobilityBounds, true);
640
641                RectF mobilityFillBounds = new RectF();
642                if (mobilityPathFill != null)
643                {
644                    mobilityPathFill.computeBounds(mobilityFillBounds, true);
645                    mobilityBounds.union(mobilityFillBounds);
646                }
647
648                //grow by one because we use a line thickness of 2.
649                RectUtilities.grow(mobilityBounds,Math.round(strokeWidthBasedOnDPI/2));
650                //mobilityBounds.set(mobilityBounds.left - 1, mobilityBounds.top - 1, mobilityBounds.right + 1, mobilityBounds.bottom + 1);
651                imageBounds.union(RectUtilities.makeRectFromRectF(mobilityBounds));
652            }
653        }
654        // </editor-fold>
655
656        // <editor-fold defaultstate="collapsed" desc="Leadership Indicator Modifier">
657        RectF liBounds = null;
658        Path liPath = null;
659        PointF liTop = null;
660        PointF liLeft = null;
661        PointF liRight = null;
662        if(ad == SymbolID.Leadership_Individual && ss == SymbolID.SymbolSet_DismountedIndividuals &&
663                (SymbolID.getFrameShape(symbolID)==SymbolID.FrameShape_DismountedIndividuals ||
664                        SymbolID.getFrameShape(symbolID)==SymbolID.FrameShape_Unknown))
665        {
666            liPath = new Path();
667
668            int si = SymbolID.getStandardIdentity(symbolID);
669            int af = SymbolID.getAffiliation(symbolID);
670            int c = SymbolID.getContext(symbolID);
671            //int fs = SymbolID.getFrameShape(symbolID);
672            double centerOffset = 0;
673            double sideOffset = 0;
674            double left = symbolBounds.left;
675            double right = symbolBounds.left + symbolBounds.width();
676
677            if(af == SymbolID.StandardIdentity_Affiliation_Unknown || af == SymbolID.StandardIdentity_Affiliation_Pending)
678            {
679                centerOffset = (symbolBounds.height()*0.1012528735632184);
680                sideOffset = (right - left)*0.3583513488109785;
681                //left = symbolBounds.getCenterX() - ((symbolBounds.getWidth() / 2) * 0.66420458);
682                //right = symbolBounds.getCenterX() + ((symbolBounds.getWidth() / 2) * 0.66420458);
683            }
684            if(af == SymbolID.StandardIdentity_Affiliation_Neutral)
685            {
686                centerOffset = (symbolBounds.height()*0.25378787878787878);
687                sideOffset = (right - left)*0.2051402812352822;
688            }
689            if(SymbolUtilities.isReality(symbolID) || SymbolUtilities.isSimulation(symbolID))
690            {
691                if(af==SymbolID.StandardIdentity_Affiliation_Friend || af==SymbolID.StandardIdentity_Affiliation_AssumedFriend)
692                {//hexagon friend/assumed friend
693                    centerOffset = (symbolBounds.height()*0.08);
694                    sideOffset = (right - left)*0.282714524168219;//(symbolBounds.getHeight()*0.29);
695                }
696                else if(af==SymbolID.StandardIdentity_Affiliation_Hostile_Faker || af==SymbolID.StandardIdentity_Affiliation_Suspect_Joker)
697                {//diamond hostile/suspect
698
699                    left = symbolBounds.centerX() - ((symbolBounds.width() / 2) * 1.0653694149);//1.07);//1.0653694149);
700                    right = symbolBounds.centerX() + ((symbolBounds.width() / 2) * 1.0653694149);//1.07);//1.0653694149);
701
702                    centerOffset = (symbolBounds.height()*0.08);//0.0751139601139601
703                    sideOffset = (right - left)*0.4923255424955992;
704                }
705            }
706            else//Exercise
707            {
708                //hexagon
709                if(af!=SymbolID.StandardIdentity_Affiliation_Unknown ||
710                        af==SymbolID.StandardIdentity_Affiliation_Neutral)
711                {
712                    centerOffset = (symbolBounds.height()*0.08);
713                    sideOffset = (right - left)*0.282714524168219;
714                }
715            }
716
717            //create leadership indicator /\
718            liTop = new PointF(symbolBounds.centerX(), (float)(symbolBounds.top - centerOffset));
719            liLeft = new PointF((float)left, (float)(liTop.y + sideOffset));
720            liRight = new PointF((float)right, (float)(liTop.y + sideOffset));
721
722
723            liPath.moveTo(liTop.x, liTop.y);
724            liPath.lineTo(liLeft.x, liLeft.y);
725            liPath.moveTo(liTop.x, liTop.y);
726            liPath.lineTo(liRight.x, liRight.y);//*/
727
728
729            liBounds = new RectF(liLeft.x, liTop.y, liRight.x - liLeft.x, liLeft.y - liTop.y);
730
731            RectUtilities.grow(liBounds,2);
732
733            imageBounds.union(RectUtilities.makeRectFromRectF(liBounds));
734        }
735
736        // </editor-fold>
737
738        // <editor-fold defaultstate="collapsed" desc="Build Echelon">
739        //Draw Echelon
740        int intEchelon = SymbolID.getAmplifierDescriptor(symbolID);
741        String strEchelon = SymbolUtilities.getEchelonText(intEchelon);
742
743        if (strEchelon != null
744                && SymbolUtilities.hasModifier(symbolID, Modifiers.B_ECHELON))
745        {
746
747            int echelonOffset = 2,
748                    outlineOffset = RS.getTextOutlineWidth();
749
750            tiEchelon = new TextInfo(strEchelon, 0, 0, modifierFont, modifierFontName);
751            echelonBounds = tiEchelon.getTextBounds();
752
753            int y = Math.round(symbolBounds.left - echelonOffset);
754            int x = Math.round(symbolBounds.left + (symbolBounds.width() / 2)
755                    - (echelonBounds.width() / 2));
756            tiEchelon.setLocation(x, y);
757
758            //There will never be lowercase characters in an echelon so trim that fat.
759            //Remove the descent from the bounding box.
760            tiEchelon.getTextOutlineBounds();//.shiftBR(0,Math.round(-(echelonBounds.height()*0.3)));
761
762            //make echelon bounds a little more spacious for things like nearby labels and Task Force.
763            RectUtilities.grow(echelonBounds, outlineOffset);
764            //tiEchelon.getTextOutlineBounds();
765//                RectUtilities.shift(echelonBounds, x, -outlineOffset);
766            //echelonBounds.shift(0,-outlineOffset);// - Math.round(echelonOffset/2));
767            tiEchelon.setLocation(x, y - outlineOffset);
768
769            imageBounds.union(echelonBounds);
770
771        }
772        // </editor-fold>
773
774        // <editor-fold defaultstate="collapsed" desc="Build Task Force">
775        Rect tfBounds = null;
776        Rect tfRectangle = null;
777        if (SymbolUtilities.isTaskForce(symbolID) && SymbolUtilities.hasModifier(symbolID, Modifiers.D_TASK_FORCE_INDICATOR))
778        {
779
780            int height = Math.round(symbolBounds.height() / 4.0f);
781            int width = Math.round(symbolBounds.width() / 3.0f);
782
783            if(!SymbolUtilities.hasRectangleFrame(symbolID))
784            {
785                height = (int)Math.round(symbolBounds.height() / 6.0f);
786            }
787
788            tfRectangle = RectUtilities.makeRect((int) symbolBounds.left + width,
789                    (int) symbolBounds.top - height,
790                    width,
791                    height);
792
793            tfBounds = RectUtilities.makeRect(tfRectangle.left + -1,
794                    tfRectangle.top - 1,
795                    tfRectangle.width() + 2,
796                    tfRectangle.height() + 2);
797
798            if (echelonBounds != null)
799            {
800                /*tfRectangle = new Rect(echelonBounds.left,
801                        echelonBounds.top,// + outlineOffset,
802                        echelonBounds.right,
803                        symbolBounds.top-1);
804                tfBounds = new Rect(tfRectangle);*/
805
806                int tfx = tfRectangle.left;
807                int tfw = tfRectangle.width();
808                int tfy = tfRectangle.top;
809                int tfh = tfRectangle.height();
810
811                if(echelonBounds.width() > tfRectangle.width())
812                {
813                    tfx = symbolBounds.left + symbolBounds.width()/2 - (echelonBounds.width()/2) - 1;
814                    tfw = echelonBounds.width()+2;
815                }
816                if(echelonBounds.height() > tfRectangle.height())
817                {
818                    tfy = echelonBounds.top-1;
819                    tfh = echelonBounds.height()+2;
820
821                }
822                tfRectangle = RectUtilities.makeRect((int)tfx,
823                        tfy,// + outlineOffset,
824                        tfw,
825                        tfh);
826
827
828                tfBounds = RectUtilities.makeRect((tfRectangle.left - 1),
829                        (tfRectangle.top - 1),
830                        (tfRectangle.width() + 2),
831                        (tfRectangle.height() + 2));
832            }
833
834            imageBounds.union(tfBounds);
835        }
836        // </editor-fold>
837
838        // <editor-fold defaultstate="collapsed" desc="Build Feint Dummy Indicator">
839        Rect fdiBounds = null;
840        Point fdiTop = null;
841        Point fdiLeft = null;
842        Point fdiRight = null;
843
844
845        if (SymbolUtilities.hasFDI(symbolID)
846                && SymbolUtilities.canSymbolHaveModifier(symbolID, Modifiers.AB_FEINT_DUMMY_INDICATOR))
847        {
848            //create feint indicator /\
849            fdiLeft = new Point((int) symbolBounds.left, (int) symbolBounds.top);
850            fdiRight = new Point((int) (symbolBounds.left + symbolBounds.width()), (int) symbolBounds.top);
851            fdiTop = new Point(Math.round(RectUtilities.getCenterX(symbolBounds)), Math.round(symbolBounds.top - (symbolBounds.width() * .5f)));
852
853
854            fdiBounds = RectUtilities.makeRect(fdiLeft.x, fdiLeft.y, 1, 1);
855            fdiBounds.union(fdiTop.x, fdiTop.y);
856            fdiBounds.union(fdiRight.x, fdiRight.y);
857
858            float fdiStrokeWidth = Math.round(RendererSettings.getInstance().getDeviceDPI() / 96f);
859            RectUtilities.grow(fdiBounds,Math.round(fdiStrokeWidth/2));
860
861            if (echelonBounds != null)
862            {
863                int shiftY = Math.round(symbolBounds.top - echelonBounds.height() - 2);
864                fdiLeft.offset(0, shiftY);
865                fdiTop.offset(0, shiftY);
866                fdiRight.offset(0, shiftY);
867                fdiBounds.offset(0, shiftY);
868            }
869
870            imageBounds.union(fdiBounds);
871
872        }
873        // </editor-fold>
874
875        //Using SVG files for installation indicator now
876        // <editor-fold defaultstate="collapsed" desc="Build Installation">
877        /*//Using SVG files for the installation indicator
878        Rect instRectangle = null;
879        Rect instBounds = null;
880        if (SymbolUtilities.hasInstallationModifier(symbolID)
881                && SymbolUtilitiesD.canSymbolHaveModifier(symbolID, Modifiers.AC_INSTALLATION))
882        {//the actual installation symbols have the modifier
883            //built in.  everything else, we have to draw it.
884            //
885            ////get indicator dimensions////////////////////////////////
886            int width;
887            int height;
888            char affiliation = SymbolUtilities.getAffiliation(symbolID);
889
890            if (affiliation == 'F'
891                    || affiliation == 'A'
892                    || affiliation == 'D'
893                    || affiliation == 'M'
894                    || affiliation == 'J'
895                    || affiliation == 'K')
896            {
897                //4th height, 3rd width
898                height = Math.round(symbolBounds.height() / 4);
899                width = Math.round(symbolBounds.width() / 3);
900            }
901            else if (affiliation == 'H' || affiliation == 'S')//hostile,suspect
902            {
903                //6th height, 3rd width
904                height = Math.round(symbolBounds.height() / 6);
905                width = Math.round(symbolBounds.width() / 3);
906            }
907            else if (affiliation == 'N' || affiliation == 'L')//neutral,exercise neutral
908            {
909                //6th height, 3rd width
910                height = Math.round(symbolBounds.height() / 6);
911                width = Math.round(symbolBounds.width() / 3);
912            }
913            else if (affiliation == 'P'
914                    || affiliation == 'U'
915                    || affiliation == 'G'
916                    || affiliation == 'W')
917            {
918                //6th height, 3rd width
919                height = Math.round(symbolBounds.height() / 6);
920                width = Math.round(symbolBounds.width() / 3);
921            }
922            else
923            {
924                //6th height, 3rd width
925                height = Math.round(symbolBounds.height() / 6);
926                width = Math.round(symbolBounds.width() / 3);
927            }
928
929//                    if(width * 3 < symbolBounds.width())
930//                        width++;
931            //set installation position/////////////////////////////////
932            //set position of indicator
933            if (affiliation == 'F'
934                    || affiliation == 'A'
935                    || affiliation == 'D'
936                    || affiliation == 'M'
937                    || affiliation == 'J'
938                    || affiliation == 'K'
939                    || affiliation == 'N'
940                    || affiliation == 'L')
941            {
942                instRectangle = RectUtilities.makeRect((int) (symbolBounds.left + width),
943                        (int) (symbolBounds.top - height),
944                        width,
945                        height);
946            }
947            else if (affiliation == 'H' || affiliation == 'S')//hostile,suspect
948            {
949                instRectangle = RectUtilities.makeRect((int) symbolBounds.left + width,
950                        Math.round((int) symbolBounds.top - (height * 0.15f)),
951                        width,
952                        height);
953            }
954            else if (affiliation == 'P'
955                    || affiliation == 'U'
956                    || affiliation == 'G'
957                    || affiliation == 'W')
958            {
959                instRectangle = RectUtilities.makeRect((int) symbolBounds.left + width,
960                        Math.round(symbolBounds.top - (height * 0.3f)),
961                        width,
962                        height);
963            }
964            else
965            {
966                instRectangle = RectUtilities.makeRect((int) symbolBounds.left + width,
967                        Math.round(symbolBounds.top - (height * 0.3f)),
968                        width,
969                        height);
970            }
971
972            //generate installation bounds//////////////////////////////
973            instBounds = new Rect(instRectangle.left + -1,
974                    instRectangle.top - 1,
975                    instRectangle.width() + 2,
976                    instRectangle.height() + 2);
977
978            imageBounds.union(instBounds);
979
980        }//*/
981        // </editor-fold>
982
983        // <editor-fold defaultstate="collapsed" desc="Build Engagement Bar (AO)">
984        //A:BBB-CC
985        String strAO = null;
986        Rect ebRectangle = null;
987        Rect ebBounds = null;
988        Rect ebTextBounds = null;
989        TextInfo ebText = null;
990
991        int ebTop = 0;
992        int ebLeft = 0;
993        int ebWidth = 0;
994        int ebHeight = 0;
995        Color ebColor = null;//SymbolUtilities.getFillColorOfAffiliation(symbolID);
996
997        if(attributes.containsKey(MilStdAttributes.EngagementBarColor))
998            ebColor = RendererUtilities.getColorFromHexString(attributes.get(MilStdAttributes.EngagementBarColor));
999        else
1000            ebColor = fillColor;
1001
1002        if(SymbolUtilities.hasModifier(symbolID, Modifiers.AO_ENGAGEMENT_BAR) &&
1003                modifiers.containsKey(Modifiers.AO_ENGAGEMENT_BAR))
1004            strAO = modifiers.get(Modifiers.AO_ENGAGEMENT_BAR);
1005        if(strAO != null)
1006        {
1007            ebText = new TextInfo(strAO, 0, 0, modifierFont, modifierFontName);
1008            ebTextBounds = ebText.getTextBounds();
1009            ebHeight = ebTextBounds.height() + 4;
1010
1011            int barOffset = Math.max(RendererSettings.getInstance().getDeviceDPI()/32, 4);
1012
1013            if(fdiBounds != null)//set bar above FDI if present
1014            {
1015                ebTop = fdiBounds.top - ebHeight - barOffset;
1016            }
1017            else if(tfBounds != null)//set bar above TF if present
1018            {
1019                ebTop = tfBounds.top - ebHeight - barOffset;
1020            }
1021            else if(echelonBounds != null)//set bar above echelon if present
1022            {
1023                ebTop = echelonBounds.top - ebHeight - barOffset;
1024            }
1025            else if((isCOnTop(symbolID) && modifiers.containsKey(Modifiers.C_QUANTITY)) ||
1026                        SymbolID.getContext(symbolID) == SymbolID.StandardIdentity_Context_Exercise ||
1027                        SymbolID.getContext(symbolID) == SymbolID.StandardIdentity_Context_Simulation)
1028            {
1029                ebTop = symbolBounds.top - (int)(ebHeight*2.5f);
1030            }
1031            else if(ss == SymbolID.SymbolSet_LandInstallation)
1032            {
1033                ebTop = symbolBounds.top - ebHeight - (barOffset * 2);
1034            }
1035            else//position above symbol
1036            {
1037                ebTop = symbolBounds.top - ebHeight - barOffset;
1038            }
1039
1040            //if text wider than symbol, extend the bar.
1041            if(ebTextBounds.width() > symbolBounds.width())
1042            {
1043                ebWidth = ebTextBounds.width() + 4;
1044                ebLeft = symbolCenter.x - (ebWidth/2);
1045            }
1046            else
1047            {
1048                ebLeft = symbolBounds.left + (int)Math.ceil(strokeWidthBasedOnDPI/2f);//1;//leave room for outline
1049                ebWidth = symbolBounds.width() - (int)Math.ceil(strokeWidthBasedOnDPI);//2;//leave room for outline
1050            }
1051
1052            //set text location within the bar
1053            ebText.setLocation(symbolCenter.x - (ebTextBounds.width()/2), ebTop + ebHeight - ((ebHeight - ebTextBounds.height()) / 2));
1054
1055            ebRectangle = RectUtilities.makeRect(ebLeft,ebTop,ebWidth,ebHeight);
1056            ebBounds = new Rect(ebRectangle);
1057            RectUtilities.grow(ebBounds,(int)Math.ceil(strokeWidthBasedOnDPI/2f));
1058
1059            imageBounds.union(ebBounds);
1060        }
1061
1062
1063        // </editor-fold>
1064
1065        // <editor-fold defaultstate="collapsed" desc="Build Affiliation Modifier">
1066        String affiliationModifier = null;
1067        if (RS.getDrawAffiliationModifierAsLabel() == false)
1068        {
1069            affiliationModifier = SymbolUtilities.getStandardIdentityModifier(symbolID);
1070        }
1071        if (affiliationModifier != null)
1072        {
1073
1074            int amOffset = 2;
1075            int outlineOffset = RS.getTextOutlineWidth();
1076
1077            tiAM = new TextInfo(affiliationModifier, 0, 0, modifierFont, modifierFontName);
1078            amBounds = tiAM.getTextBounds();
1079
1080            int x, y;
1081
1082            if (echelonBounds != null
1083                    && ((echelonBounds.left + echelonBounds.width() > symbolBounds.left + symbolBounds.width())))
1084            {
1085                y = Math.round(symbolBounds.top - amOffset);
1086                x = echelonBounds.left + echelonBounds.width();
1087            }
1088            else
1089            {
1090                y = Math.round(symbolBounds.top - amOffset);
1091                x = Math.round(symbolBounds.left + symbolBounds.width());
1092            }
1093            tiAM.setLocation(x, y);
1094
1095            //adjust for outline.
1096            RectUtilities.grow(amBounds, outlineOffset);
1097            RectUtilities.shift(amBounds, 0, -outlineOffset);
1098            tiAM.setLocation(x, y - outlineOffset);
1099
1100            imageBounds.union(amBounds);
1101        }
1102        // </editor-fold>
1103
1104        // <editor-fold defaultstate="collapsed" desc="Build HQ Staff">
1105        Point pt1HQ = null;
1106        Point pt2HQ = null;
1107        Rect hqBounds = null;
1108        //Draw HQ Staff
1109        if (SymbolUtilities.isHQ(symbolID))
1110        {
1111            int affiliation = SymbolID.getAffiliation(symbolID);
1112            int context = SymbolID.getContext(symbolID);
1113            //get points for the HQ staff
1114            if (SymbolUtilities.hasRectangleFrame(symbolID))
1115            {
1116                pt1HQ = new Point((int) symbolBounds.left + 1,
1117                        (int) (symbolBounds.top + symbolBounds.height() - 1));
1118            }
1119            else
1120            {
1121                pt1HQ = new Point((int) symbolBounds.left + 1,
1122                        (int) (symbolBounds.top + (symbolBounds.height() / 2)));
1123            }
1124            pt2HQ = new Point((int) pt1HQ.x, (int) (pt1HQ.y + symbolBounds.height()));
1125
1126            //create bounding rectangle for HQ staff.
1127            hqBounds = new Rect(pt1HQ.x, pt1HQ.y, pt1HQ.x + 2, pt2HQ.y);
1128            //adjust the image bounds accordingly.
1129            imageBounds.union(hqBounds);
1130            //imageBounds.shiftBR(0,pt2HQ.y-imageBounds.bottom);
1131            //adjust symbol center
1132            centerPoint.set(pt2HQ.x, pt2HQ.y);
1133        }
1134
1135        // </editor-fold>
1136
1137        // <editor-fold defaultstate="collapsed" desc="Build DOM Arrow">
1138        Point[] domPoints = null;
1139        Rect domBounds = null;
1140        if (modifiers.containsKey(Modifiers.Q_DIRECTION_OF_MOVEMENT)
1141                && SymbolUtilities.hasModifier(symbolID, Modifiers.Q_DIRECTION_OF_MOVEMENT))
1142        {
1143                String strQ = modifiers.get(Modifiers.Q_DIRECTION_OF_MOVEMENT);
1144                
1145                if(strQ != null && SymbolUtilities.isNumber(strQ))
1146                {
1147                    float q = Float.valueOf(strQ);
1148        
1149                    boolean isY = (modifiers.containsKey(Modifiers.Y_LOCATION));
1150        
1151                    domPoints = createDOMArrowPoints(symbolID, symbolBounds, symbolCenter, q, isY, modifierFontHeight);
1152        
1153                    domBounds = new Rect(domPoints[0].x, domPoints[0].y, 1, 1);
1154        
1155                    Point temp = null;
1156                    for (int i = 1; i < 6; i++)
1157                    {
1158                        temp = domPoints[i];
1159                        if (temp != null)
1160                        {
1161                            domBounds.union(temp.x, temp.y);
1162                        }
1163                    }
1164                    imageBounds.union(domBounds);
1165                }
1166        }
1167
1168        // </editor-fold>
1169
1170        // <editor-fold defaultstate="collapsed" desc="Build Operational Condition Indicator">
1171        Rect ociBounds = null;
1172        RectF ociBoundsF = null;
1173        Rect ociShape = null;
1174        Path ociSlashShape = null;
1175        int ociOffset = Math.max(RendererSettings.getInstance().getDeviceDPI()/32, 4);
1176        if (SymbolUtilities.canSymbolHaveModifier(symbolID, Modifiers.AL_OPERATIONAL_CONDITION)) {
1177            if (mobilityBounds != null)
1178            {
1179                ociOffset = Math.round(mobilityBounds.bottom - symbolBounds.bottom) + 4;
1180            }
1181            if(RendererSettings.getInstance().getOperationalConditionModifierType() == RendererSettings.OperationalConditionModifierType_BAR)
1182            {
1183                ociShape = processOperationalConditionIndicator(symbolID, symbolBounds, ociOffset);
1184                if (ociShape != null)
1185                {
1186                    Rect temp = new Rect(ociShape);
1187                    RectUtilities.grow(temp, 2);
1188                    ociBounds = temp;
1189                    imageBounds.union(ociBounds);
1190                }
1191            }
1192            else//slash
1193            {
1194                ociSlashShape = processOperationalConditionIndicatorSlash(symbolID, symbolBounds);
1195                if (ociSlashShape != null)
1196                {
1197                    //build mobility bounds
1198                    ociBoundsF = new RectF();
1199                    ociBounds = new Rect();
1200                    ociSlashShape.computeBounds(ociBoundsF, true);
1201                    ociBoundsF.roundOut(ociBounds);
1202                    imageBounds.union(ociBounds);
1203                    ociBounds = null;
1204                }
1205            }
1206        }
1207
1208        // </editor-fold>
1209
1210        // <editor-fold defaultstate="collapsed" desc="Build Restricted Indicator">
1211        RectF rBounds = null;
1212        Path rPath = null;
1213        Path rPath2 = null;
1214        SVGPath rsvgPath = null;
1215        SVGPath rsvgPath2 = null;
1216        PointF rcirclePt = null;
1217        PointF rdotPt = null;
1218        float rdotRadius = 0;
1219        float rStrokeWidth = 3;
1220        if(SymbolID.getContext(symbolID) == SymbolID.StandardIdentity_Context_Restricted_Target_Reality)
1221        {
1222            // <path id="primary" d="M380,320l38,-67l40,67h-78m38,-11v-1m0,-10l0,-20" fill="yellow" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="7" />
1223            float nsTx = 0;
1224            float nsTy = 0;
1225            float ratio = 1;
1226            SVGInfo si = SVGLookup.getInstance().getSVGLInfo(SVGLookup.getFrameID(symbolID),SymbolID.getVersion(symbolID));
1227            if(symbolBounds.height() > symbolBounds.width())
1228            {
1229                double sHeight = si.getBbox().height();
1230                ratio = (float)(symbolBounds.height() / sHeight);
1231            }
1232            else
1233            {
1234                double sWidth = si.getBbox().width();
1235                ratio = (float)(symbolBounds.width() / sWidth);
1236            }
1237
1238            nsTx = (float)(si.getBbox().left * ratio) * -1;
1239            nsTy = (float)(si.getBbox().top * ratio) * -1;
1240
1241            //<path d="m373,313l53,-97l57,97l-110,0" fill="yellow" id="triangle" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="6"/>
1242            //<path d="m373,313L426,216L483,313L373,313" fill="yellow" id="triangle" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="6"/>
1243            rPath = new Path();//triangle
1244            rPath.moveTo(373f * ratio, 313f * ratio);
1245            rPath.lineTo(426f * ratio, 216f * ratio);
1246            rPath.lineTo(483f * ratio, 313f * ratio);
1247            rPath.lineTo(373f * ratio, 313f * ratio);
1248            rsvgPath = new SVGPath();//triangle
1249            rsvgPath.moveTo(373f * ratio, 313f * ratio);
1250            rsvgPath.lineTo(426f * ratio, 216f * ratio);
1251            rsvgPath.lineTo(483f * ratio, 313f * ratio);
1252            rsvgPath.lineTo(373f * ratio, 313f * ratio);
1253
1254            //<path d="M426.5,276L426.5,244" fill="none" id="line" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="10"/>
1255            rPath2 = new Path();//line
1256            rPath2.moveTo(426.5f * ratio, 276f * ratio);
1257            rPath2.lineTo(426.5f * ratio, 248f * ratio);
1258            rsvgPath2 = new SVGPath();//line
1259            rsvgPath2.moveTo(426.5f * ratio, 276f * ratio);
1260            rsvgPath2.lineTo(426.5f * ratio, 248f * ratio);
1261
1262            //<circle cx="426.5" cy="293" r="6" id="dot"/>//DOT
1263            rdotPt = new PointF(426.5f * ratio, 293 * ratio);
1264            rdotRadius = 5f * ratio;
1265
1266            //need to shift like we do the frame and main icons since it's based in that space
1267            rPath.offset(nsTx, nsTy);
1268            rPath2.offset(nsTx, nsTy);
1269            rsvgPath.shift(nsTx,nsTy);
1270            rsvgPath2.shift(nsTx,nsTy);
1271            rdotPt.offset(nsTx,nsTy);
1272            //rCircle = (Ellipse2D) txfm.createTransformedShape(rCircle);
1273
1274
1275            //RectF bounds = new RectF();
1276            //bounds = rPath.computeBounds(bounds);  //getBounds();//triangle bounds
1277            Rect bounds = rsvgPath.getBounds();
1278            rBounds = RectUtilities.makeRectF(bounds.left,bounds.top,bounds.width(), bounds.height());
1279            rStrokeWidth = (2/66.666667f) * ((float)symbolBounds.height() / SymbolUtilities.getUnitRatioHeight(symbolID));
1280            RectUtilities.grow(rBounds,(int)Math.ceil(rStrokeWidth/2));
1281            RectUtilities.grow(bounds,(int)Math.ceil(rStrokeWidth/2));
1282            imageBounds.union(bounds);
1283        }
1284        // </editor-fold>
1285
1286        // <editor-fold defaultstate="collapsed" desc="Build No Strike Indicator">
1287        RectF nsBounds = null;
1288        PointF nsCirclePt = null;
1289        float nsRadius = 0;
1290        Path nsLine = null;
1291        SVGPath nssvgLine = null;
1292        double nsStrokeWidth = 3;
1293        if(SymbolID.getContext(symbolID) == SymbolID.StandardIdentity_Context_No_Strike_Entity_Reality)
1294        {
1295            //octagon~182.08058166503906~272.0794677734375~245.8407440185547~244.85235595703125
1296            //restricted~375.44801678047673~248.63298320770264~85.1039714496415~79.36734275822477
1297            //no-strike~378.0~248.0~80.0~80.0
1298            //<circle cx="418" cy="288" fill="yellow" r="36" stroke="black" stroke-width="8"/>
1299            //<line fill="none" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="8" x1="390" x2="446" y1="265" y2="310"/>
1300            //nsCircle = new Ellipse(x,y,radius * 2, radius * 2);
1301            //nsLine = new Line(390 * ratio, 265 * ratio, 446 * ratio, 310 * ratio);
1302            float nsTx = 0;
1303            float nsTy = 0;
1304            float ratio = 1;
1305            SVGInfo si = SVGLookup.getInstance().getSVGLInfo(SVGLookup.getFrameID(symbolID),SymbolID.getVersion(symbolID));
1306            if(symbolBounds.height() > symbolBounds.width())
1307            {
1308                float sHeight = si.getBbox().height();
1309                ratio = symbolBounds.height() / sHeight;
1310            }
1311            else
1312            {
1313                float sWidth = si.getBbox().width();
1314                ratio = symbolBounds.width() / sWidth;
1315            }
1316
1317            nsTx = (si.getBbox().left * ratio) * -1;
1318            nsTy = (si.getBbox().top * ratio) * -1;
1319
1320            float radius = 50f * ratio;
1321            float x = 426f * ratio;
1322            float y = 267f * ratio;
1323            nsCirclePt = new PointF(x,y);
1324            nsRadius = radius;
1325            nsLine = new Path();
1326            nsLine.moveTo(390 * ratio, 235 * ratio);
1327            nsLine.lineTo(463 * ratio, 298 * ratio);
1328            nssvgLine = new SVGPath();
1329            nssvgLine.moveTo(390 * ratio, 235 * ratio);
1330            nssvgLine.lineTo(463 * ratio, 298 * ratio);
1331
1332            //need to shift like we do the frame and main icons since it's based in that space
1333            nsCirclePt.offset(nsTx,nsTy);
1334            nsLine.offset(nsTx,nsTy);
1335            nssvgLine.shift(nsTx,nsTy);
1336
1337            nsBounds = RectUtilities.makeRectF(nsCirclePt.x - radius, nsCirclePt.y - radius, radius * 2, radius * 2);
1338
1339            nsStrokeWidth = (2/66.666667) * (symbolBounds.height() / SymbolUtilities.getUnitRatioHeight(symbolID));
1340            RectUtilities.grow(nsBounds,(int)Math.ceil(nsStrokeWidth/2));
1341            imageBounds.union(RectUtilities.makeRectFromRectF(nsBounds));
1342        }
1343        // </editor-fold>
1344
1345        // <editor-fold defaultstate="collapsed" desc="Build Unmanned Indicator">
1346        RectF umBounds = null;
1347        PointF umCirclePoint = null;
1348        float umCircleRadius = 9f;
1349        Path umPath = null;
1350        String umSVG = null;
1351        double umStrokeWidth = 2;
1352        PointF umStarPointSVG = null;
1353        PointF umCirclePointSVG = null;
1354        int hqtfd = SymbolID.getHQTFD(symbolID);
1355        if(pixelSize <= 50)
1356            umStrokeWidth = 1;
1357        if(hqtfd == SymbolID.HQTFD_Unmanned_Marker ||
1358                hqtfd == SymbolID.HQTFD_Unmanned_Marker_Autonomous ||
1359                hqtfd == SymbolID.HQTFD_Unmanned_Marker_Remotely_Piloted ||
1360                hqtfd == SymbolID.HQTFD_Unmanned_Marker_FeintDummy ||
1361                hqtfd == SymbolID.HQTFD_Unmanned_Marker_Autonomous_FeintDummy ||
1362                hqtfd == SymbolID.HQTFD_Unmanned_Marker_Remotely_Piloted_FeintDummy)
1363        {
1364            //octagon~182.08058166503906~272.0794677734375~245.8407440185547~244.85235595703125
1365            //restricted~375.44801678047673~248.63298320770264~85.1039714496415~79.36734275822477
1366            //no-strike~378.0~248.0~80.0~80.0
1367            //<circle cx="418" cy="288" fill="yellow" r="36" stroke="black" stroke-width="8"/>
1368            //<line fill="none" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="8" x1="390" x2="446" y1="265" y2="310"/>
1369            //nsCircle = new Ellipse(x,y,radius * 2, radius * 2);
1370            //nsLine = new Line(390 * ratio, 265 * ratio, 446 * ratio, 310 * ratio);
1371            double nsTx = 0;
1372            double nsTy = 0;
1373            double ratio = 1;
1374            float ratioF = 1f;
1375            SVGInfo si = SVGLookup.getInstance().getSVGLInfo(SVGLookup.getFrameID(symbolID),SymbolID.getVersion(symbolID));
1376            if(symbolBounds.height() > symbolBounds.width())
1377            {
1378                double sHeight = si.getBbox().height();
1379                ratio = symbolBounds.height() / sHeight;
1380            }
1381            else
1382            {
1383                double sWidth = si.getBbox().width();
1384                ratio = symbolBounds.width() / sWidth;
1385            }
1386
1387            ratioF = (float)ratio;
1388            float umTx = (si.getBbox().left * ratioF) * -1;
1389            float umTy = (si.getBbox().top * ratioF) * -1;
1390
1391            float xOffset = 0;
1392            float yOffset = 0;
1393
1394            char fs = SymbolID.getFrameShape(symbolID);
1395            if(fs == 0)
1396                fs = SymbolID.getDefaultFrameShape(symbolID);
1397
1398
1399            Rectangle2D octagonBounds = new Rectangle2D.Double(182.08058166503906,272.0794677734375,245.8407440185547,244.85235595703125);
1400            int affiliation = SymbolID.getAffiliation(symbolID);
1401
1402            if(fs == SymbolID.FrameShape_SeaSubsurface || affiliation == SymbolID.StandardIdentity_Affiliation_Neutral ||
1403                    (affiliation == SymbolID.StandardIdentity_Affiliation_Friend &&
1404                            (ss == SymbolID.SymbolSet_LandUnit ||
1405                                    ss == SymbolID.SymbolSet_LandInstallation ||
1406                                    ss == SymbolID.SymbolSet_Activities ||
1407                                    ss == SymbolID.SymbolSet_CyberSpace
1408                            )))
1409            {
1410                //indicator just sits on the left side of the symbol
1411                String frameID = SVGLookup.getFrameID(symbolID);
1412                SVGInfo siFrame = SVGLookup.getInstance().getSVGLInfo(frameID,SymbolID.getVersion(symbolID));
1413
1414                int lineWidthAdjustment = 9;
1415                xOffset = (205 -  siFrame.getBbox().left - lineWidthAdjustment) * -1;
1416                //xOffset = -305 * ratio;//((octagonBounds.getWidth() * 1.3) - half) * -1;
1417            }
1418            else if(affiliation == SymbolID.StandardIdentity_Affiliation_Unknown &&
1419                    ss == SymbolID.SymbolSet_SeaSubsurface)
1420            {
1421                String frameID = SVGLookup.getFrameID(symbolID);
1422                SVGInfo siFrame = SVGLookup.getInstance().getSVGLInfo(frameID,SymbolID.getVersion(symbolID));
1423                xOffset = ((205 -  siFrame.getBbox().left) * 0.75f) * -1;
1424            }
1425            else//else, rest can use default position of x=205
1426            {
1427                yOffset = -20;
1428            }
1429
1430            umPath = createUnmannedIndicatorShape(xOffset ,yOffset);
1431            Matrix scaleMatrix = new Matrix();
1432            scaleMatrix.setScale((float)ratio,(float)ratio);
1433            umPath.transform(scaleMatrix);
1434            if(hqtfd == SymbolID.HQTFD_Unmanned_Marker || hqtfd == SymbolID.HQTFD_Unmanned_Marker_FeintDummy) {
1435                umCirclePoint = new PointF((205f + xOffset) * ratioF, (310.188f + yOffset) * ratioF);
1436                umCircleRadius = 9f/2f * ratioF;
1437            }
1438            umBounds = RendererUtilities.getPathBounds(umPath); //RectUtilities.toRectangle2D(169,277,72,66);
1439            RectUtilities.grow(umBounds,(int)Math.ceil(umStrokeWidth/2));
1440
1441            //need to shift like we do the frame and main icons since it's based in that space
1442            //AffineTransform txfm = AffineTransform.getTranslateInstance(nsTx,nsTy);
1443            if(umCirclePoint != null) {
1444                umCirclePoint = new PointF(umCirclePoint.x + umTx, umCirclePoint.y + umTy);
1445            }
1446            Matrix translateMatrix = new Matrix();
1447            translateMatrix.setTranslate(umTx,umTy);
1448            umPath.transform(translateMatrix);
1449            umBounds = RendererUtilities.getPathBounds(umPath);
1450            imageBounds.union(RectUtilities.makeRectFromRectF(umBounds));
1451
1452            //For SVG output
1453            umStarPointSVG = new PointF(205,343.841f);
1454            umCirclePointSVG = new PointF(205,310);
1455
1456            //adjust start points and bounds with offset.
1457            umStarPointSVG.x = umStarPointSVG.x + xOffset;
1458            umStarPointSVG.y = umStarPointSVG.y + yOffset;
1459            umCirclePointSVG.x = umCirclePointSVG.x + xOffset;
1460            umCirclePointSVG.y = umCirclePointSVG.y + yOffset;
1461            RectUtilities.shift(umBounds,xOffset,yOffset);
1462        }
1463        // </editor-fold>
1464
1465        // <editor-fold defaultstate="collapsed" desc="Shift Modifiers">
1466        //adjust points if necessary
1467        if (sdi instanceof ImageInfo && (imageBounds.left < 0 || imageBounds.top < 0))
1468        {
1469            int shiftX = Math.abs(imageBounds.left);
1470            int shiftY = Math.abs(imageBounds.top);
1471
1472            if (hqBounds != null)
1473            {
1474                pt1HQ.offset(shiftX, shiftY);
1475                pt2HQ.offset(shiftX, shiftY);
1476            }
1477            if (echelonBounds != null)
1478            {
1479                tiEchelon.setLocation(tiEchelon.getLocation().x + shiftX, tiEchelon.getLocation().y + shiftY);
1480            }
1481            if (amBounds != null)
1482            {
1483                tiAM.setLocation(tiAM.getLocation().x + shiftX, tiAM.getLocation().y + shiftY);
1484            }
1485            if (tfBounds != null)
1486            {
1487                tfRectangle.offset(shiftX, shiftY);
1488                tfBounds.offset(shiftX, shiftY);
1489            }
1490            if(ebBounds != null)
1491            {
1492                ebRectangle.offset(shiftX, shiftY);
1493                ebBounds.offset(shiftX, shiftY);
1494                ebText.shift(shiftX, shiftY);
1495                ebTextBounds.offset(shiftX, shiftY);
1496            }
1497            /*if (instBounds != null)//part of symbol bounds now
1498            {
1499                instRectangle.offset(shiftX, shiftY);
1500                instBounds.offset(shiftX, shiftY);
1501            }//*/
1502            if (fdiBounds != null)
1503            {
1504                fdiBounds.offset(shiftX, shiftY);
1505                fdiLeft.offset(shiftX, shiftY);
1506                fdiTop.offset(shiftX, shiftY);
1507                fdiRight.offset(shiftX, shiftY);
1508            }
1509            if (liBounds != null)
1510            {
1511                liBounds.offset(shiftX, shiftY);
1512                liLeft.offset(shiftX, shiftY);
1513                liTop.offset(shiftX, shiftY);
1514                liRight.offset(shiftX, shiftY);
1515                if(liPath != null)
1516                {
1517                    liPath.offset(shiftX,shiftY);
1518                }
1519            }
1520            if (ociBounds != null)
1521            {
1522                ociBounds.offset(shiftX, shiftY);
1523                ociShape.offset(shiftX, shiftY);
1524            }
1525            if(ociBoundsF != null)
1526            {
1527                ociBoundsF.offset(shiftX, shiftY);
1528                ociSlashShape.offset(shiftX, shiftY);
1529            }
1530            if(rBounds != null)
1531            {
1532                rBounds.offset(shiftX, shiftY);//bounds
1533                rPath.offset(shiftX, shiftY);//triangle
1534                rPath2.offset(shiftX, shiftY);//exclamation
1535                rdotPt.offset(shiftX, shiftY);//dot
1536            }
1537            if(nsBounds != null)
1538            {
1539                nsBounds.offset(shiftX, shiftY);//bounds
1540                nsCirclePt.offset(shiftX, shiftY);//circle
1541                nsLine.offset(shiftX, shiftY);//line
1542            }
1543            if(umBounds != null)
1544            {
1545                umBounds.offset(shiftX, shiftY);//bounds
1546                if(umCirclePoint != null)
1547                    umCirclePoint.offset(shiftX, shiftY);//circle
1548                umPath.offset(shiftX, shiftY);//star
1549            }
1550            if (domBounds != null)
1551            {
1552                for (int i = 0; i < 6; i++)
1553                {
1554                    Point temp = domPoints[i];
1555                    if (temp != null)
1556                    {
1557                        temp.offset(shiftX, shiftY);
1558                    }
1559                }
1560                domBounds.offset(shiftX, shiftY);
1561            }
1562            if (mobilityBounds != null)
1563            {
1564                //shift mobility points
1565                mobilityPath.offset(shiftX, shiftY);
1566                if (mobilityPathFill != null)
1567                {
1568                    mobilityPathFill.offset(shiftX, shiftY);
1569                }
1570
1571                mobilityBounds.offset(shiftX, shiftY);
1572            }
1573
1574            centerPoint.offset(shiftX, shiftY);
1575            symbolBounds.offset(shiftX, shiftY);
1576            imageBounds.offset(shiftX, shiftY);
1577        }
1578        // </editor-fold>
1579
1580        // <editor-fold defaultstate="collapsed" desc="Convert to SVG (SVGSymbolInfo)">
1581        if(sdi instanceof SVGSymbolInfo)
1582        {
1583            StringBuilder sbSVG = new StringBuilder();
1584            Path temp = null;
1585            SVGPath svgtemp = null;
1586            String svgStroke = RendererUtilities.colorToHexString(lineColor,false);
1587            String svgFill = RendererUtilities.colorToHexString(fillColor,false);
1588            String svgTextColor = RendererUtilities.colorToHexString(textColor,false);
1589            String svgTextBGColor = RendererUtilities.colorToHexString(textBackgroundColor,false);
1590            String svgStrokeWidth = String.valueOf(strokeWidthBasedOnDPI);
1591            String svgTextOutlineWidth = String.valueOf(RendererSettings.getInstance().getTextOutlineWidth());
1592            String svgAlpha = "1";
1593            if(alpha >= 0 && alpha <= 1)
1594                svgAlpha = String.valueOf(alpha);
1595            String svgDashArray = null;
1596
1597            if(hqBounds != null)
1598            {
1599                /*Line2D hqStaff = new Line2D.Double(pt1HQ,pt2HQ);
1600                temp = new Path2D.Double();
1601                temp.append(hqStaff,false);
1602                sbSVG.append(Shape2SVG.Convert(temp, svgStroke, null, svgStrokeWidth, svgAlpha, svgAlpha, null));//*/
1603
1604                svgtemp = new SVGPath();
1605                svgtemp.moveTo(pt1HQ.x, pt1HQ.y);
1606                svgtemp.lineTo(pt2HQ.x, pt2HQ.y);
1607                svgtemp.toSVGElement(svgStroke,Float.parseFloat(svgStrokeWidth),null,Float.parseFloat(svgAlpha),Float.parseFloat(svgAlpha),null);
1608            }
1609            if (echelonBounds != null)
1610            {
1611                sbSVG.append(Shape2SVG.Convert(tiEchelon, svgTextBGColor, svgTextColor, svgTextOutlineWidth, svgAlpha, svgAlpha, null));
1612            }
1613            if (amBounds != null)
1614            {
1615                sbSVG.append(Shape2SVG.Convert(tiAM, svgTextBGColor, svgTextColor, svgTextOutlineWidth, svgAlpha, svgAlpha, null));
1616            }
1617            if (tfBounds != null)
1618            {
1619                sbSVG.append(Shape2SVG.Convert(tfRectangle, svgStroke, null, svgStrokeWidth, svgAlpha, svgAlpha, null,null));
1620            }
1621            if(ebBounds != null)
1622            {
1623                String svgEBFill = RendererUtilities.colorToHexString(ebColor,false);
1624                //create fill and outline
1625                sbSVG.append(Shape2SVG.Convert(ebRectangle, svgStroke, svgEBFill, svgStrokeWidth, svgAlpha, svgAlpha, null,null));
1626                //create internal text
1627                sbSVG.append(Shape2SVG.Convert(ebText, null, "#000000", null, svgAlpha, svgAlpha, null));
1628            }
1629            if (fdiBounds != null)
1630            {
1631                /*int dpi = RendererSettings.getInstance().getDeviceDPI();
1632                int lineLength = dpi / 96 * 6;
1633                int lineGap = dpi / 96 * 4;
1634                String svgFDIDashArray = "" + lineLength + " " + lineGap;//*/
1635
1636                /// ///////////////////////////////////
1637                //Divide line in 14 parts. line is 3 parts to 2 parts gap
1638                float distance = RendererUtilities.getDistanceBetweenPoints(fdiTop,fdiLeft);
1639                //distance = distance / 14f;
1640                int lineGap = (int)((distance / 14f) * 2);
1641                int lineLength = (int)((distance / 14f) * 3);
1642                String svgFDIDashArray = "" + lineLength + " " + lineGap;
1643                /// //////////////////////////////////
1644
1645                SVGPath fdiPath = new SVGPath();
1646
1647                fdiPath.moveTo(fdiTop.x, fdiTop.y);
1648                fdiPath.lineTo(fdiLeft.x, fdiLeft.y);
1649                fdiPath.moveTo(fdiTop.x, fdiTop.y);
1650                fdiPath.lineTo(fdiRight.x, fdiRight.y);//*/
1651
1652                sbSVG.append(Shape2SVG.Convert(fdiPath, svgStroke, null, svgStrokeWidth, svgAlpha, svgAlpha, svgFDIDashArray,"round"));
1653
1654            }
1655            if (liBounds != null)
1656            {
1657                SVGPath svgliPath = new SVGPath();
1658                svgliPath.moveTo(liTop.x, liTop.y);
1659                svgliPath.lineTo(liLeft.x, liLeft.y);
1660                svgliPath.moveTo(liTop.x, liTop.y);
1661                svgliPath.lineTo(liRight.x, liRight.y);
1662
1663                sbSVG.append(svgliPath.toSVGElement(svgStroke,strokeWidthBasedOnDPI,null,Float.parseFloat(svgAlpha),Float.parseFloat(svgAlpha),"round"));
1664                //sbSVG.append(Shape2SVG.Convert(liPath, svgStroke, null, String.valueOf(liStrokeWidth), svgAlpha, svgAlpha, null));
1665            }
1666            if (ociBounds != null && ociShape != null)
1667            {
1668
1669                int status = SymbolID.getStatus(symbolID);
1670                Color statusColor = null;
1671
1672                switch (status) {
1673                    //Fully Capable
1674                    case SymbolID.Status_Present_FullyCapable:
1675                        statusColor = Color.green;
1676                        break;
1677                    //Damaged
1678                    case SymbolID.Status_Present_Damaged:
1679                        statusColor = Color.yellow;
1680                        break;
1681                    //Destroyed
1682                    case SymbolID.Status_Present_Destroyed:
1683                        statusColor = Color.red;
1684                        break;
1685                    //full to capacity(hospital)
1686                    case SymbolID.Status_Present_FullToCapacity:
1687                        statusColor = Color.blue;
1688                        break;
1689                    default:
1690                        break;
1691                }
1692
1693                String svgOCIStatusColor = RendererUtilities.colorToHexString(statusColor,false);
1694                sbSVG.append(Shape2SVG.Convert(ociBounds, null, svgStroke, svgStrokeWidth, svgAlpha, svgAlpha, null,null));
1695                sbSVG.append(Shape2SVG.Convert(ociShape, null, svgOCIStatusColor, svgStrokeWidth, svgAlpha, svgAlpha, null,null));
1696
1697                ociBounds = null;
1698                ociShape = null;
1699
1700            }
1701
1702            if (mobilityBounds != null)
1703            {
1704                if(svgMobilityGroup != null)
1705                    sbSVG.append(svgMobilityGroup);
1706                else if (svgMobilityPath != null)
1707                    sbSVG.append(svgMobilityPath.toSVGElement(svgStroke,strokeWidthBasedOnDPI,null,Float.parseFloat(svgAlpha),Float.parseFloat(svgAlpha),null));
1708
1709                mobilityBounds = null;
1710            }
1711
1712            //add symbol
1713            ssi = (SVGSymbolInfo)sdi;
1714            sbSVG.append(ssi.getSVG());
1715
1716            if (ociBounds != null && ociSlashShape != null)
1717            {
1718                SVGPath svgociSlash = processOperationalConditionIndicatorSlashSVG(symbolID,symbolBounds);
1719
1720                double size = symbolBounds.width();
1721                float ociStrokeWidth = 3f;
1722
1723                ociStrokeWidth = (float) size / 20f;
1724                if (ociStrokeWidth < 1f)
1725                    ociStrokeWidth = 1f;
1726
1727                sbSVG.append(svgociSlash.toSVGElement(svgStroke,ociStrokeWidth,null,Float.parseFloat(svgAlpha),Float.parseFloat(svgAlpha),null));
1728                //sbSVG.append(Shape2SVG.Convert(ociSlashShape, svgStroke, null, String.valueOf(ociStrokeWidth), svgAlpha, svgAlpha, null));
1729                ociBounds = null;
1730                ociSlashShape = null;
1731            }
1732
1733            if(rBounds != null)
1734            {
1735                String restrictedGroup = "<g id=\"restricted\" stroke-linecap=\"round\" stroke-linejoin=\"round\">";
1736                //triangle
1737                restrictedGroup += Shape2SVG.Convert(rsvgPath, "#000000", "#FFFF00", String.valueOf(rStrokeWidth),svgAlpha,svgAlpha,null,null);
1738                //exclamation
1739                restrictedGroup += Shape2SVG.Convert(rsvgPath2, "#000000", null, String.valueOf(rStrokeWidth * 1.66667),svgAlpha,svgAlpha,null,null);
1740                //dot
1741                restrictedGroup += Shape2SVG.ConvertCircle(rdotPt, rdotRadius, "#000000", "#000000", String.valueOf(rStrokeWidth),svgAlpha,svgAlpha,null);
1742                restrictedGroup += "</g>";
1743
1744                sbSVG.append(restrictedGroup);
1745            }
1746
1747            if(nsBounds != null)
1748            {
1749                String noStrikeGroup = "<g id=\"nostrike\">";
1750                noStrikeGroup += Shape2SVG.ConvertCircle(nsCirclePt, nsRadius,"#000000", "#FFFF00", String.valueOf(nsStrokeWidth),svgAlpha,svgAlpha,null);
1751                noStrikeGroup += Shape2SVG.Convert(nssvgLine, "#000000", null, String.valueOf(nsStrokeWidth),svgAlpha,svgAlpha,null,null);
1752                noStrikeGroup += "</g>";
1753                sbSVG.append(noStrikeGroup);
1754            }
1755
1756            if(umBounds != null)
1757            {
1758                String umStroke = "#000000";
1759                String umFill = "#FFFFFF";
1760                if(hqtfd == SymbolID.HQTFD_Unmanned_Marker_Autonomous || hqtfd == SymbolID.HQTFD_Unmanned_Marker_Autonomous_FeintDummy)
1761                {
1762                    umStroke = "#FFFFFF";
1763                    umFill = "#000000";
1764                }
1765
1766                umSVG = "<g id=\"UM\">\n\t";
1767                umSVG += "<path stroke=\"" + umStroke + "\" fill=\"" + umFill + "\" stroke-width=\"" + umStrokeWidth + "\" d=\"M" + umStarPointSVG.x + "," + umStarPointSVG.y + "c-3.207,-5.299,-5.694,-10.540,-9.796,-15.138c-1.306,-1.614,-2.681,-3.184,-4.121,-4.691c-5.808,-5.497,-12.601,-11.068,-20.332,-13.823c7.731,-2.755,14.524,-8.326,20.332,-13.823c1.440,-1.508,2.816,-3.077,4.121,-4.691c4.102,-4.598,6.590,-9.840,9.796,-15.138c3.207,5.299,5.694,10.540,9.796,15.138c1.306,1.614,2.681,3.184,4.121,4.691c5.808,5.497,12.601,11.068,20.332,13.823c-7.731,2.755,-14.524,8.326,-20.332,13.823c-1.440,1.508,-2.816,3.077,-4.121,4.691c-4.102,4.598,-6.590,9.840,-9.796,15.138z\"/>";
1768                if(hqtfd == SymbolID.HQTFD_Unmanned_Marker || hqtfd == SymbolID.HQTFD_Unmanned_Marker_FeintDummy)
1769                    umSVG += "\n\t" + "<circle r=\"7\" cx=\"" + umCirclePointSVG.x + "\" cy=\"" + umCirclePointSVG.y + "\" fill=\"black\" />";
1770                umSVG += "\n</g>";
1771
1772                //Make it part of the symbol group so it gets scaled accordingly
1773                sbSVG.insert(sbSVG.length()-4,umSVG);
1774            }
1775
1776            if (domBounds != null)
1777            {
1778                //Path2D domPath = new Path2D.Double();
1779                SVGPath domPath = new SVGPath();
1780
1781                domPath.moveTo(domPoints[0].x, domPoints[0].y);
1782                if (domPoints[1] != null)
1783                {
1784                    domPath.lineTo(domPoints[1].x, domPoints[1].y);
1785                }
1786                if (domPoints[2] != null)
1787                {
1788                    domPath.lineTo(domPoints[2].x, domPoints[2].y);
1789                }
1790                //sbSVG.append(Shape2SVG.Convert(domPath, svgStroke, null, svgStrokeWidth, svgAlpha, svgAlpha, null));
1791                sbSVG.append(domPath.toSVGElement(svgStroke, Float.parseFloat(svgStrokeWidth), null,Float.parseFloat(svgAlpha), Float.parseFloat(svgAlpha),null));
1792
1793
1794                //domPath.reset();
1795                domPath = new SVGPath();
1796
1797                domPath.moveTo(domPoints[3].x, domPoints[3].y);
1798                domPath.lineTo(domPoints[4].x, domPoints[4].y);
1799                domPath.lineTo(domPoints[5].x, domPoints[5].y);
1800                sbSVG.append(Shape2SVG.Convert(domPath, "none", svgStroke, "0", svgAlpha, svgAlpha, null,null));
1801                sbSVG.append(domPath.toSVGElement("none", 0f, svgStroke,Float.parseFloat(svgAlpha), Float.parseFloat(svgAlpha),null));
1802
1803                domBounds = null;
1804                domPoints = null;
1805            }
1806
1807            newsdi = new SVGSymbolInfo(sbSVG.toString(),centerPoint,symbolBounds,imageBounds);
1808        }
1809
1810        // </editor-fold>
1811
1812        // <editor-fold defaultstate="collapsed" desc="Draw Modifiers (ImageInfo)">
1813        if(sdi instanceof ImageInfo)
1814        {
1815            ii = (ImageInfo) sdi;
1816
1817            Bitmap bmp = Bitmap.createBitmap(imageBounds.width(), imageBounds.height(), Config.ARGB_8888);
1818            Canvas ctx = new Canvas(bmp);
1819
1820            if (echelonBounds != null || amBounds != null) {
1821                //   ctx.font = RendererSettings.getModifierFont();
1822            }
1823
1824            //render////////////////////////////////////////////////////////
1825            Paint paint = new Paint();
1826            paint.setStyle(Style.STROKE);
1827            //paint.setColor(Color.black.toInt());
1828            paint.setColor(lineColor.toInt());
1829            if (alpha > -1)
1830                paint.setAlpha(alpha);
1831            paint.setStrokeWidth(2.0f);
1832
1833            paint.setStrokeWidth(strokeWidthBasedOnDPI);
1834
1835            if (hqBounds != null) {
1836                ctx.drawLine(pt1HQ.x, pt1HQ.y, pt2HQ.x, pt2HQ.y, paint);
1837            }
1838
1839            if (tfBounds != null) {
1840                ctx.drawRect(tfRectangle, paint);
1841            }
1842
1843        /*if (instBounds != null) Part of frame SVG now
1844        {
1845            paint.setStyle(Style.FILL);
1846            ctx.drawRect(instRectangle, paint);
1847        }//*/
1848
1849            if (ebBounds != null) {
1850                //draw bar fill
1851                paint.setStyle(Style.FILL);
1852                paint.setColor(ebColor.toInt());
1853                ctx.drawRect(ebRectangle, paint);
1854
1855                //draw bar outline
1856                paint.setStyle(Style.STROKE);
1857                paint.setStrokeWidth(4.0f);
1858                paint.setColor(lineColor.toInt());
1859                ctx.drawRect(ebRectangle, paint);
1860
1861                //draw bar text
1862                modifierFont.setColor(Color.BLACK.toInt());
1863                modifierFont.setStyle(Style.FILL);
1864                ctx.drawText(ebText.getText(), ebText.getLocation().x, ebText.getLocation().y, modifierFont);
1865
1866                ebBounds = null;
1867                ebText = null;
1868                ebRectangle = null;
1869                paint.setStrokeWidth(strokeWidthBasedOnDPI);//2.0f
1870            }
1871
1872            if (echelonBounds != null) {
1873                TextInfo[] aTiEchelon =
1874                        {
1875                                tiEchelon
1876                        };
1877                renderText(ctx, aTiEchelon, textColor, textBackgroundColor, modifierFont);
1878
1879                echelonBounds = null;
1880                tiEchelon = null;
1881            }
1882
1883            if (amBounds != null) {
1884                TextInfo[] aTiAM =
1885                        {
1886                                tiAM
1887                        };
1888                renderText(ctx, aTiAM, textColor, textBackgroundColor, modifierFont);
1889                amBounds = null;
1890                tiAM = null;
1891            }
1892
1893            if (fdiBounds != null) {
1894
1895                Paint fdiPaint = new Paint();
1896                fdiPaint.setAntiAlias(true);
1897                fdiPaint.setColor(lineColor.toInt());/// setARGB(255, 0, 0, 0);
1898                if (alpha > -1)
1899                    fdiPaint.setAlpha(alpha);
1900                fdiPaint.setStyle(Style.STROKE);
1901
1902                /*int dpi = RendererSettings.getInstance().getDeviceDPI();
1903
1904                int lineLength = dpi / 96 * 6;
1905                int lineGap = dpi / 96 * 4;//*/
1906
1907                /// ///////////////////////////////////
1908                //Divide line in 14 parts. line is 3 parts to 2 parts gap
1909                float distance = RendererUtilities.getDistanceBetweenPoints(fdiTop,fdiLeft);
1910                //distance = distance / 14f;
1911                int lineGap = (int)((distance / 14f) * 2);
1912                int lineLength = (int)((distance / 14f) * 3);
1913                /// //////////////////////////////////
1914
1915                fdiPaint.setPathEffect(new DashPathEffect(new float[]
1916                        {
1917                                lineLength, lineGap
1918                        }, 0));
1919
1920
1921                fdiPaint.setStrokeCap(Cap.ROUND);
1922                fdiPaint.setStrokeJoin(Join.MITER);
1923                fdiPaint.setStrokeWidth(strokeWidthBasedOnDPI);
1924
1925                Path fdiPath = new Path();
1926
1927                fdiPath.moveTo(fdiTop.x, fdiTop.y);
1928                fdiPath.lineTo(fdiLeft.x, fdiLeft.y);
1929                fdiPath.moveTo(fdiTop.x, fdiTop.y);
1930                fdiPath.lineTo(fdiRight.x, fdiRight.y);
1931                ctx.drawPath(fdiPath, fdiPaint);
1932
1933                fdiBounds = null;
1934
1935            }
1936
1937            if (liBounds != null) {
1938
1939                Paint liPaint = new Paint();
1940                liPaint.setAntiAlias(true);
1941                liPaint.setColor(lineColor.toInt());/// setARGB(255, 0, 0, 0);
1942                if (alpha > -1)
1943                    liPaint.setAlpha(alpha);
1944                liPaint.setStyle(Style.STROKE);
1945
1946                int dpi = RendererSettings.getInstance().getDeviceDPI();
1947
1948                liPaint.setStrokeCap(Cap.BUTT);
1949                liPaint.setStrokeJoin(Join.MITER);
1950                liPaint.setStrokeWidth(strokeWidthBasedOnDPI);
1951
1952                ctx.drawPath(liPath, liPaint);
1953
1954                liBounds = null;
1955
1956            }
1957
1958            if (mobilityBounds != null) {
1959                Paint mobilityPaint = new Paint();
1960                mobilityPaint.setStyle(Style.STROKE);
1961                //mobilityPaint.setColor(Color.black.toInt());
1962                mobilityPaint.setColor(lineColor.toInt());
1963                if (alpha > -1)
1964                    mobilityPaint.setAlpha(alpha);
1965
1966                //ctx.lineCap = "butt";
1967                //ctx.lineJoin = "miter";
1968                if (ad >= SymbolID.Mobility_WheeledLimitedCrossCountry && ad < SymbolID.Mobility_ShortTowedArray)//mobility
1969                {
1970                    //mobilityPaint.setStrokeWidth(3f);
1971                    mobilityPaint.setStrokeWidth(strokeWidthBasedOnDPI);
1972                    mobilityPaint.setAntiAlias(true);
1973                } else //towed-array
1974                {
1975                    //mobilityPaint.setStrokeWidth(3f);
1976                    mobilityPaint.setStrokeWidth(strokeWidthBasedOnDPI);
1977                    //mobilityPaint.setAntiAlias(true);
1978                }
1979
1980                ctx.drawPath(mobilityPath, mobilityPaint);
1981
1982                if (mobilityPathFill != null) {
1983                    mobilityPaint.setStyle(Style.FILL);
1984                    ctx.drawPath(mobilityPathFill, mobilityPaint);
1985                }
1986
1987                mobilityBounds = null;
1988
1989            }
1990
1991            if (ociBounds != null) {
1992                Paint ociPaint = new Paint();
1993
1994                int statusColor = 0;
1995                int status = SymbolID.getStatus(symbolID);
1996                if (status == (SymbolID.Status_Present_FullyCapable))//Fully Capable
1997                {
1998                    statusColor = Color.green.toInt();
1999                } else if (status == (SymbolID.Status_Present_Damaged))//Damage
2000                {
2001                    statusColor = Color.yellow.toInt();
2002                } else if (status == (SymbolID.Status_Present_Destroyed)) {
2003                    statusColor = Color.red.toInt();
2004                } else if (status == (SymbolID.Status_Present_FullToCapacity))//full to capacity(hospital)
2005                {
2006                    statusColor = Color.blue.toInt();
2007                }
2008
2009                ociPaint.setColor(lineColor.toInt());
2010                ociPaint.setStyle(Style.FILL);
2011
2012                if (alpha > -1)
2013                    ociPaint.setAlpha(alpha);
2014                ctx.drawRect(ociBounds, ociPaint);
2015                ociPaint.setColor(statusColor);
2016                if (alpha > -1)
2017                    ociPaint.setAlpha(alpha);
2018                ctx.drawRect(ociShape, ociPaint);
2019
2020                ociBounds = null;
2021                ociShape = null;
2022            }
2023
2024            //draw original icon.
2025            //ctx.drawImage(ii.getImage(),symbolBounds.left, symbolBounds.top);
2026            ctx.drawBitmap(ii.getImage(), null, symbolBounds, null);
2027
2028            if(rBounds != null)
2029            {
2030                Paint rPaint = new Paint();
2031                rPaint.setColor(Color.YELLOW.toInt());
2032                rPaint.setAlpha(alpha);
2033                rPaint.setStrokeCap(Cap.ROUND);
2034                rPaint.setStrokeJoin(Join.ROUND);
2035                rPaint.setStyle(Style.FILL);
2036                //triangle fill
2037                ctx.drawPath(rPath, rPaint);
2038
2039                //triangle outline
2040                rPaint.setStrokeWidth(rStrokeWidth);
2041                rPaint.setStyle(Style.STROKE);
2042                rPaint.setColor(Color.BLACK.toInt());
2043                ctx.drawPath(rPath, rPaint);
2044
2045                //exclamation line
2046                rPaint.setStrokeWidth(rStrokeWidth * 1.66667f);
2047                ctx.drawPath(rPath2, rPaint);
2048
2049                //exclamation dot
2050                rPaint.setStrokeWidth(rStrokeWidth);
2051                rPaint.setStyle(Style.FILL_AND_STROKE);
2052                ctx.drawCircle(rdotPt.x,rdotPt.y,rdotRadius,rPaint);
2053
2054            }
2055            if(nsBounds != null)
2056            {
2057                Paint nsPaint = new Paint();
2058                nsPaint.setColor(Color.YELLOW.toInt());
2059                nsPaint.setAlpha(alpha);
2060                nsPaint.setStrokeCap(Cap.ROUND);
2061                nsPaint.setStrokeJoin(Join.ROUND);
2062                nsPaint.setStyle(Style.FILL);
2063
2064                //circle fill
2065                ctx.drawCircle(nsCirclePt.x, nsCirclePt.y,nsRadius,nsPaint);
2066
2067                //circle outline
2068                nsPaint.setStyle(Style.STROKE);
2069                nsPaint.setColor(Color.BLACK.toInt());
2070                nsPaint.setStrokeWidth((float)nsStrokeWidth);
2071                ctx.drawCircle(nsCirclePt.x,nsCirclePt.y,nsRadius,nsPaint);
2072
2073                //draw slash
2074                ctx.drawPath(nsLine,nsPaint);
2075
2076            }
2077            if(umBounds != null)
2078            {
2079                Paint umPaint = new Paint();
2080                Color umStroke = Color.BLACK;
2081                Color umFill = Color.WHITE;
2082                if(hqtfd == SymbolID.HQTFD_Unmanned_Marker_Autonomous || hqtfd == SymbolID.HQTFD_Unmanned_Marker_Autonomous_FeintDummy)
2083                {
2084                    umStroke = Color.WHITE;
2085                    umFill = Color.BLACK;
2086                }
2087
2088                umPaint.setStrokeWidth((float)umStrokeWidth);
2089                umPaint.setColor(umFill.toInt());
2090                umPaint.setAlpha(alpha);
2091                umPaint.setStyle(Style.FILL);
2092                ctx.drawPath(umPath,umPaint);
2093                umPaint.setColor(umStroke.toInt());
2094                umPaint.setStyle(Style.STROKE);
2095                ctx.drawPath(umPath,umPaint);
2096
2097                if(umCirclePoint != null) {
2098                    umPaint.setColor(Color.BLACK.toInt());
2099                    umPaint.setStyle(Style.FILL);
2100                    ctx.drawCircle(umCirclePoint.x,umCirclePoint.y,umCircleRadius,umPaint);
2101                }
2102            }
2103
2104            if (domBounds != null) {
2105                drawDOMArrow(ctx, domPoints, alpha, lineColor);
2106
2107                domBounds = null;
2108                domPoints = null;
2109            }
2110
2111            if (ociBoundsF != null) {
2112                Paint ociPaint = new Paint();
2113                int size = symbolBounds.width();
2114                float ociStrokeWidth = 3f;
2115
2116                ociStrokeWidth = size / 20f;
2117                if (ociStrokeWidth < 1f)
2118                    ociStrokeWidth = 1f;
2119            /*if(size > 50 && size < 100)
2120                ociStrokeWidth = 5f;
2121            else if(size >= 100 && size < 200)
2122                ociStrokeWidth = 7f;
2123            else if(size >= 200)
2124                ociStrokeWidth = 10f;*/
2125                //ociPaint.setColor(Color.black.toInt());
2126                ociPaint.setColor(lineColor.toInt());
2127                if (alpha > -1)
2128                    ociPaint.setAlpha(alpha);
2129                ociPaint.setStrokeWidth(ociStrokeWidth);
2130                ociPaint.setStrokeCap(Cap.BUTT);
2131                ociPaint.setStyle(Style.STROKE);
2132                ociPaint.setAntiAlias(true);
2133                ctx.drawPath(ociSlashShape, ociPaint);
2134
2135                ociBoundsF = null;
2136                ociSlashShape = null;
2137            }
2138
2139
2140            if (bmp != null)
2141                newsdi = new ImageInfo(bmp, centerPoint, symbolBounds);
2142        }
2143        // </editor-fold>
2144
2145        // <editor-fold defaultstate="collapsed" desc="Cleanup">
2146        // </editor-fold>
2147        if (newsdi != null)
2148        {
2149            return newsdi;
2150        }
2151        else
2152        {
2153            return null;
2154        }
2155
2156    }
2157
2158    /**
2159     *
2160     * @param symbolID
2161     * @return
2162     * @deprecated no longer a thing in 2525D
2163     * TODO: remove
2164     */
2165    private static double getYPositionForSCC(String symbolID)
2166    {
2167        double yPosition = 0.32;
2168        /*int aff = SymbolID.getAffiliation(symbolID);
2169        int context = SymbolID.getContext(symbolID);
2170        char affiliation = symbolID.charAt(1);
2171
2172        if(temp.equals("WMGC--"))//GROUND (BOTTOM) MILCO
2173        {
2174            if(affiliation == 'H' || 
2175                    affiliation == 'S')//suspect
2176                yPosition = 0.29;
2177            else if(affiliation == 'N' ||
2178                    affiliation == 'L')//exercise neutral
2179                yPosition = 0.32;
2180            else if(affiliation == 'F' ||
2181                    affiliation == 'A' ||//assumed friend
2182                    affiliation == 'D' ||//exercise friend
2183                    affiliation == 'M' ||//exercise assumed friend
2184                    affiliation == 'K' ||//faker
2185                    affiliation == 'J')//joker
2186                yPosition = 0.32;
2187            else
2188                yPosition = 0.34;
2189        }
2190        else if(temp.equals("WMMC--"))//MOORED MILCO
2191        {
2192            if(affiliation == 'H' || 
2193                    affiliation == 'S')//suspect
2194                yPosition = 0.25;
2195            else if(affiliation == 'N' ||
2196                    affiliation == 'L')//exercise neutral
2197                yPosition = 0.25;
2198            else if(affiliation == 'F' ||
2199                    affiliation == 'A' ||//assumed friend
2200                    affiliation == 'D' ||//exercise friend
2201                    affiliation == 'M' ||//exercise assumed friend
2202                    affiliation == 'K' ||//faker
2203                    affiliation == 'J')//joker
2204                yPosition = 0.25;
2205            else
2206                yPosition = 0.28;
2207        }
2208        else if(temp.equals("WMFC--"))//FLOATING MILCO
2209        {
2210            if(affiliation == 'H' || 
2211                    affiliation == 'S')//suspect
2212                yPosition = 0.29;
2213            else if(affiliation == 'N' ||
2214                    affiliation == 'L')//exercise neutral
2215                yPosition = 0.32;
2216            else if(affiliation == 'F' ||
2217                    affiliation == 'A' ||//assumed friend
2218                    affiliation == 'D' ||//exercise friend
2219                    affiliation == 'M' ||//exercise assumed friend
2220                    affiliation == 'K' ||//faker
2221                    affiliation == 'J')//joker
2222                yPosition = 0.32;
2223            else
2224                yPosition= 0.34;
2225        }
2226        else if(temp.equals("WMC---"))//GENERAL MILCO
2227        {
2228            if(affiliation == 'H' || 
2229                    affiliation == 'S')//suspect
2230                yPosition = 0.33;
2231            else if(affiliation == 'N' ||
2232                    affiliation == 'L')//exercise neutral
2233                yPosition = 0.36;
2234            else if(affiliation == 'F' ||
2235                    affiliation == 'A' ||//assumed friend
2236                    affiliation == 'D' ||//exercise friend
2237                    affiliation == 'M' ||//exercise assumed friend
2238                    affiliation == 'K' ||//faker
2239                    affiliation == 'J')//joker
2240                yPosition = 0.36;
2241            else
2242                yPosition = 0.36;
2243        }*/
2244        
2245        return yPosition;
2246    }
2247
2248    /**
2249     *
2250     * @param {type} symbolID
2251     * @param {type} bounds symbolBounds SO.Rectangle
2252     * @param {type} center SO.Point Location where symbol is centered.
2253     * @param {type} angle in degrees
2254     * @param {Boolean} isY Boolean.
2255     * @returns {Array} of SO.Point. First 3 items are the line. Last three are
2256     * the arrowhead.
2257     */
2258    private static Point[] createDOMArrowPoints(String symbolID, Rect bounds, Point center, float angle, boolean isY, float modifierFontHeight)
2259    {
2260        Point[] arrowPoints = new Point[6];
2261        Point pt1 = null;
2262        Point pt2 = null;
2263        Point pt3 = null;
2264
2265        int affiliation = SymbolID.getAffiliation(symbolID);
2266        int context = SymbolID.getContext(symbolID);
2267        int length = 40;
2268        if (SymbolUtilities.isCBRNEvent(symbolID))
2269        {
2270            length = Math.round(bounds.height() / 2);
2271        }
2272        else if((SymbolUtilities.isHQ(symbolID)))
2273        {
2274            if(SymbolUtilities.hasRectangleFrame(symbolID))
2275                length = bounds.height();
2276            else
2277                length = (int)Math.round(bounds.height() * 0.7);
2278        }
2279        else// if(bounds.height() >= 100)
2280        {
2281            length = (int)Math.round(bounds.height() * 0.7);
2282        }
2283
2284        //get endpoint
2285        int dx2, dy2,
2286                x1, y1,
2287                x2, y2;
2288
2289        x1 = Math.round(center.x);
2290        y1 = Math.round(center.y);
2291
2292        pt1 = new Point(x1, y1);
2293
2294        if (SymbolUtilities.hasModifier(symbolID, Modifiers.Q_DIRECTION_OF_MOVEMENT ) &&
2295            SymbolUtilities.isCBRNEvent(symbolID) ||
2296                SymbolUtilities.isLand(symbolID) ||
2297                SymbolID.getSymbolSet(symbolID)==SymbolID.SymbolSet_DismountedIndividuals)
2298        {
2299            //drawStaff = true;
2300            if(SymbolUtilities.isHQ(symbolID)==false)//has HQ staff to start from
2301            {
2302                y1 = bounds.top + bounds.height();
2303                pt1 = new Point(x1, y1);
2304
2305                if (isY == true && SymbolUtilities.isCBRNEvent(symbolID))//make room for y modifier
2306                {
2307                    int yModifierOffset = (int) modifierFontHeight;
2308
2309                    yModifierOffset += RS.getTextOutlineWidth();
2310
2311                    pt1.offset(0, yModifierOffset);
2312                }
2313
2314                y1 = y1 + length;
2315                pt2 = new Point(x1, y1);
2316            }
2317            else
2318            {
2319                x1 = bounds.left+1;
2320                pt2 = new Point(x1, y1);
2321                if(SymbolUtilities.hasRectangleFrame(symbolID))
2322                {
2323                    /*y1 = bounds.top + bounds.height();
2324                    pt1 = new Point(x1, y1);
2325                    y1 = y1 + length;
2326                    pt2 = new Point(x1, y1);//*/
2327
2328                    pt1.x = x1;
2329                    y1 = bounds.top + (bounds.height());
2330                    pt1.y = y1;
2331                    x2 = x1;
2332                    pt2.x = x2;
2333                    y1 = pt1.y + bounds.height();
2334                    pt2.y = y1;//*/
2335
2336                }
2337                else
2338                {
2339                    pt1.x = x1;
2340                    y1 = bounds.top + (bounds.height() / 2);
2341                    pt1.y = y1;
2342                    x2 = x1;
2343                    pt2.x = x2;
2344                    y1 = pt1.y + bounds.height();
2345                    pt2.y = y1;
2346                }
2347            }
2348        }
2349
2350            //get endpoint given start point and an angle
2351        //x2 = x1 + (length * Math.cos(radians)));
2352        //y2 = y1 + (length * Math.sin(radians)));
2353        angle = angle - 90;//in java, east is zero, we want north to be zero
2354        double radians = 0;
2355        radians = (angle * (Math.PI / 180));//convert degrees to radians
2356
2357        dx2 = x1 + (int) (length * Math.cos(radians));
2358        dy2 = y1 + (int) (length * Math.sin(radians));
2359        x2 = Math.round(dx2);
2360        y2 = Math.round(dy2);
2361
2362
2363        //UPDATED ARROWHEAD CODE
2364        Point[] head = null;
2365        Point endPoint = new Point((int) x2, (int) y2);
2366        if(pt2 != null)
2367            head = createDOMArrowHead(pt2, endPoint);//pt3);
2368        else
2369            head = createDOMArrowHead(pt1, endPoint);//pt3);
2370
2371        if(head != null)
2372        {
2373            arrowPoints[0] = pt1;
2374            arrowPoints[1] = pt2;
2375            arrowPoints[2] = pt3;
2376            arrowPoints[3] = head[0];
2377            arrowPoints[4] = head[1];
2378            arrowPoints[5] = head[2];
2379
2380            //adjusted endpoint
2381            if(head.length >= 4 && head[3] != null)
2382            {
2383                arrowPoints[2] = head[3];
2384            }
2385        }
2386
2387        return arrowPoints;
2388
2389    }
2390
2391    private static Point[] createDOMArrowHead(Point lpt1, Point lpt2)
2392    {
2393        Point[] arrowPoints = new Point[6];
2394        Point pt1 = null;
2395        Point pt2 = null;
2396        Point pt3 = null;
2397
2398        int x1 = lpt1.x;
2399        int y1 = lpt1.y;
2400        int x2 = lpt2.x;
2401        int y2 = lpt2.y;
2402
2403        // Compute direction vector
2404        double dx = x2 - x1;
2405        double dy = y2 - y1;
2406        double length = Math.sqrt(dx * dx + dy * dy);
2407
2408        // Scale triangle size
2409        double scale = length * 0.1;  // Scaling factor for size
2410        double offset = scale * 1.5;  // Move triangle further down the line
2411
2412        // Normalize direction vector
2413        double unitX = dx / length;
2414        double unitY = dy / length;
2415
2416        // Compute perpendicular vector for triangle base
2417        double nx = -unitY;
2418        double ny = unitX;
2419
2420        // Compute adjusted triangle vertices
2421        int tipX = x2;
2422        int tipY = y2;
2423        int baseX1 = (int) (x2 - offset * unitX + scale * nx);
2424        int baseY1 = (int) (y2 - offset * unitY + scale * ny);
2425        int baseX2 = (int) (x2 - offset * unitX - scale * nx);
2426        int baseY2 = (int) (y2 - offset * unitY - scale * ny);
2427
2428
2429        //arrowHead = new Polygon(xPoints, yPoints, 3);
2430        arrowPoints[0] = new Point(tipX,tipY);
2431        arrowPoints[1] = new Point(baseX1,baseY1);
2432        arrowPoints[2] = new Point(baseX2,baseY2);
2433        // Adjust line endpoint to be the middle of the base line of the arrowhead
2434        int adjustedX2 = (baseX1 + baseX2) / 2;
2435        int adjustedY2 = (baseY1 + baseY2) / 2;
2436        arrowPoints[3] = new Point(adjustedX2,adjustedY2);
2437
2438        return arrowPoints;
2439
2440    }
2441
2442    private static void drawDOMArrow(Canvas ctx, Point[] domPoints, int alpha, Color lineColor)
2443    {
2444        float domStrokeWidth = Math.round(RendererSettings.getInstance().getDeviceDPI() / 96f);
2445        if(domStrokeWidth < 1)
2446            domStrokeWidth=1;
2447
2448
2449        Paint domPaint = new Paint();
2450        domPaint.setAntiAlias(true);
2451        domPaint.setStrokeCap(Cap.BUTT);
2452        domPaint.setStrokeJoin(Join.MITER);
2453        domPaint.setStrokeWidth(domStrokeWidth);//3
2454        domPaint.setColor(lineColor.toInt());
2455        domPaint.setStyle(Style.STROKE);
2456        if(alpha > -1)
2457            domPaint.setAlpha(alpha);
2458
2459        Path domPath = new Path();
2460        domPath.moveTo(domPoints[0].x, domPoints[0].y);
2461        if (domPoints[1] != null)
2462        {
2463            domPath.lineTo(domPoints[1].x, domPoints[1].y);
2464        }
2465        if (domPoints[2] != null)
2466        {
2467            domPath.lineTo(domPoints[2].x, domPoints[2].y);
2468        }
2469        ctx.drawPath(domPath, domPaint);
2470
2471        domPath.reset();
2472        domPaint.setStyle(Style.FILL);
2473        domPath.moveTo(domPoints[3].x, domPoints[3].y);
2474        domPath.lineTo(domPoints[4].x, domPoints[4].y);
2475        domPath.lineTo(domPoints[5].x, domPoints[5].y);
2476        ctx.drawPath(domPath, domPaint);
2477    }
2478
2479    private static Path createUnmannedIndicatorShape()
2480    {
2481        return createUnmannedIndicatorShape(0,0);
2482    }
2483    private static Path createUnmannedIndicatorShape(float xOffset, float yOffset) {
2484        Path path = new Path();
2485
2486        // Track cursor for relative offset calculations
2487        float x = 205.000f + xOffset;
2488        float y = 343.841f + yOffset;
2489
2490        // 1. Establish the scaled starting point (Bottom Tip)
2491        path.moveTo(x, y);
2492
2493        // 2. Bottom-Left Quadrant
2494        // rCubicTo parameters: (dx1, dy1, dx2, dy2, dx3, dy3) relative to the cursor
2495        path.rCubicTo(-3.207f, -5.299f, -5.694f, -10.540f, -9.796f, -15.138f);
2496        path.rCubicTo(-1.306f, -1.614f, -2.681f, -3.184f, -4.121f, -4.691f);
2497        path.rCubicTo(-5.808f, -5.497f, -12.601f, -11.068f, -20.332f, -13.823f);
2498
2499        // 3. Top-Left Quadrant
2500        path.rCubicTo(7.731f, -2.755f, 14.524f, -8.326f, 20.332f, -13.823f);
2501        path.rCubicTo(1.440f, -1.508f, 2.816f, -3.077f, 4.121f, -4.691f);
2502        path.rCubicTo(4.102f, -4.598f, 6.590f, -9.840f, 9.796f, -15.138f);
2503
2504        // 4. Top-Right Quadrant
2505        path.rCubicTo(3.207f, 5.299f, 5.694f, 10.540f, 9.796f, 15.138f);
2506        path.rCubicTo(1.306f, 1.614f, 2.681f, 3.184f, 4.121f, 4.691f);
2507        path.rCubicTo(5.808f, 5.497f, 12.601f, 11.068f, 20.332f, 13.823f);
2508
2509        // 5. Bottom-Right Quadrant
2510        path.rCubicTo(-7.731f, 2.755f, -14.524f, 8.326f, -20.332f, 13.823f);
2511        path.rCubicTo(-1.440f, 1.508f, -2.816f, 3.077f, -4.121f, 4.691f);
2512        path.rCubicTo(-4.102f, 4.598f, -6.590f, 9.840f, -9.796f, 15.138f);
2513
2514        // 6. Close the path
2515        path.close();
2516
2517        return path;
2518    }
2519
2520    private static Rect processOperationalConditionIndicator(String symbolID, Rect symbolBounds, int offsetY)
2521    {
2522        //create Operational Condition Indicator
2523        //set color
2524        Rect bar = null;
2525        int status;
2526        Color statusColor;
2527        int barSize = 0;
2528        int pixelSize = symbolBounds.height();
2529
2530        status = SymbolID.getStatus(symbolID);
2531        if (status == SymbolID.Status_Present_FullyCapable ||
2532                status == SymbolID.Status_Present_Damaged ||
2533                status == SymbolID.Status_Present_Destroyed ||
2534                status == SymbolID.Status_Present_FullToCapacity)
2535        {
2536            if (pixelSize > 0)
2537            {
2538                barSize = Math.round(pixelSize / 5);
2539            }
2540
2541            if (barSize < 2)
2542            {
2543                barSize = 2;
2544            }
2545
2546            offsetY += Math.round(symbolBounds.top + symbolBounds.height());
2547
2548            bar = RectUtilities.makeRect(symbolBounds.left + 2, offsetY, Math.round(symbolBounds.width()) - 4, barSize);
2549        }
2550
2551        return bar;
2552    }
2553
2554    private static Path processOperationalConditionIndicatorSlash(String symbolID, Rect symbolBounds)
2555    {
2556        //create Operational Condition Indicator
2557        Path path = null;
2558        int status;
2559        status = SymbolID.getStatus(symbolID);
2560
2561        if (status == SymbolID.Status_Present_Damaged  || status == SymbolID.Status_Present_Destroyed)
2562        {
2563            float widthRatio = SymbolUtilities.getUnitRatioWidth(symbolID);
2564            float heightRatio = SymbolUtilities.getUnitRatioHeight(symbolID);
2565
2566            float slashHeight = (symbolBounds.height() / heightRatio * 1.47f);
2567            float slashWidth = (symbolBounds.width() / widthRatio * 0.85f);
2568            float centerX = symbolBounds.exactCenterX();
2569            float centerY = symbolBounds.exactCenterY();
2570            path = new Path();
2571            if(status == SymbolID.Status_Present_Damaged)//Damaged /
2572            {
2573                path.moveTo(centerX - (slashWidth/2),centerY+(slashHeight/2));
2574                path.lineTo(centerX + (slashWidth/2),centerY-(slashHeight/2));
2575            }
2576            else if(status == SymbolID.Status_Present_Destroyed)//Destroyed X
2577            {
2578                path.moveTo(centerX - (slashWidth/2),centerY+(slashHeight/2));
2579                path.lineTo(centerX + (slashWidth/2),centerY-(slashHeight/2));
2580                path.moveTo(centerX - (slashWidth/2),centerY-(slashHeight/2));
2581                path.lineTo(centerX + (slashWidth/2),centerY+(slashHeight/2));
2582            }
2583            return path;
2584
2585        }
2586
2587        return path;
2588    }
2589
2590    private static SVGPath processOperationalConditionIndicatorSlashSVG(String symbolID, Rect symbolBounds)
2591    {
2592        //create Operational Condition Indicator
2593        SVGPath path = null;
2594        int status;
2595        status = SymbolID.getStatus(symbolID);
2596
2597        if (status == SymbolID.Status_Present_Damaged  || status == SymbolID.Status_Present_Destroyed)
2598        {
2599            float widthRatio = SymbolUtilities.getUnitRatioWidth(symbolID);
2600            float heightRatio = SymbolUtilities.getUnitRatioHeight(symbolID);
2601
2602            float slashHeight = (symbolBounds.height() / heightRatio * 1.47f);
2603            float slashWidth = (symbolBounds.width() / widthRatio * 0.85f);
2604            float centerX = symbolBounds.exactCenterX();
2605            float centerY = symbolBounds.exactCenterY();
2606            path = new SVGPath();
2607            if(status == SymbolID.Status_Present_Damaged)//Damaged /
2608            {
2609                path.moveTo(centerX - (slashWidth/2),centerY+(slashHeight/2));
2610                path.lineTo(centerX + (slashWidth/2),centerY-(slashHeight/2));
2611            }
2612            else if(status == SymbolID.Status_Present_Destroyed)//Destroyed X
2613            {
2614                path.moveTo(centerX - (slashWidth/2),centerY+(slashHeight/2));
2615                path.lineTo(centerX + (slashWidth/2),centerY-(slashHeight/2));
2616                path.moveTo(centerX - (slashWidth/2),centerY-(slashHeight/2));
2617                path.lineTo(centerX + (slashWidth/2),centerY+(slashHeight/2));
2618            }
2619            return path;
2620
2621        }
2622
2623        return path;
2624    }
2625
2626
2627    public static SymbolDimensionInfo processSpeedLeader(SymbolDimensionInfo sdi, String symbolID, Map<String,String> modifiers, Map<String,String> attributes)
2628    {
2629        SymbolDimensionInfo rsdi = sdi;
2630
2631        Rect imageBounds = sdi.getImageBounds();
2632        Rect symbolBounds = sdi.getSymbolBounds();
2633        Point symbolCenter = sdi.getCenterPoint();
2634        int ss = SymbolID.getSymbolSet(symbolID);
2635        int pixelSize = RendererSettings.getInstance().getDefaultPixelSize();
2636        int dpi = RendererSettings.getInstance().getDeviceDPI();
2637        if(attributes != null && attributes.containsKey(MilStdAttributes.PixelSize))
2638            pixelSize = Integer.parseInt(attributes.get(MilStdAttributes.PixelSize));
2639        float strokeWidth = 3f;
2640        strokeWidth = (float) dpi / 48f;
2641        if (strokeWidth < 1f)
2642            strokeWidth = 1f;
2643
2644        Path slPath = null;
2645        SVGPath slsvgPath = null;
2646        Rect slBounds = null;
2647        try {
2648            if (SymbolUtilities.hasModifier(symbolID, Modifiers.AJ_SPEED_LEADER) &&
2649                    (modifiers != null && modifiers.containsKey(Modifiers.AJ_SPEED_LEADER)))
2650            {
2651                String aj = modifiers.get(Modifiers.AJ_SPEED_LEADER);
2652                String[] values = aj.split(" ");
2653                if (values.length >= 3) {
2654                    int speed = Integer.parseInt(values[0]);
2655                    String speedUnit = values[1];
2656                    int angle = 0;
2657                    if (values[2].length() == 3)
2658                        angle = Integer.parseInt(values[2]) - 90;
2659                    else
2660                        angle = (int) (Integer.parseInt(values[2]) * 0.05625) - 90;
2661
2662                    slPath = new Path();
2663                    slPath.moveTo(symbolCenter.x, symbolCenter.y);
2664                    slsvgPath = new SVGPath();
2665                    slsvgPath.moveTo(symbolCenter.x, symbolCenter.y);
2666
2667                    //convert to Knots
2668                    switch (speedUnit)//KPH, KPS, MPH, NMH, KTS//https://www.aviationhunt.com/speed-converter/
2669                    {
2670                        case "KPH":
2671                            speed = (int) (speed * 0.539957);
2672                            break;
2673                        case "KPS"://https://www.metric-conversions.org/speed/kilometers-per-second-to-knots.htm
2674                            speed = (int) (speed * 1943.84);
2675                            break;
2676                        case "MPH":
2677                            speed = (int) (speed * 0.86897);
2678                            break;
2679                    }
2680
2681                    int distance = 0;
2682                    char frame = SymbolID.getFrameShape(symbolID);
2683                    boolean fast = false;
2684                    if (frame == '0' && ss == SymbolID.SymbolSet_Air ||
2685                            ss == SymbolID.SymbolSet_AirMissile ||
2686                            ss == SymbolID.SymbolSet_SignalsIntelligence_Air ||
2687                            ss == SymbolID.SymbolSet_SpaceMissile ||
2688                            ss == SymbolID.SymbolSet_Space ||
2689                            (SymbolID.getVersion(symbolID) <= SymbolID.Version_2525Dch1 && ss == SymbolID.SymbolSet_SignalsIntelligence_Space))
2690                    {
2691                        fast = true;
2692                    }
2693                    else if(frame == SymbolID.FrameShape_Air || frame == SymbolID.FrameShape_Space)
2694                    {
2695                        fast = true;
2696                    }
2697
2698                    float distanceScaler = dpi;//spec does scale by inch, but if the symbol is too big, scale by pixel size
2699                    if(dpi < pixelSize)
2700                        distanceScaler = pixelSize;
2701
2702                    if(fast)
2703                    {//aircraft might be 1/4 inch if its speed is less than 300 knots, 1/2 inch if its speed is between 300 and 600 knots and 3/4 inch if its speed is more than 600 knots.
2704                        if (speed < 300)
2705                            distance = (int) (distanceScaler * 0.25)/300 * speed;
2706                        else if (speed < 600)
2707                            distance = (int) (distanceScaler * 0.5)/600 * speed;
2708                        else
2709                            distance = (int) (distanceScaler * 0.75);
2710                    }
2711                    else//submarine might be 1/4 inch if its speed is less than 15 knots, 1/2 inch if its speed is between 15 and 30 knots and 3/4 inch if its speed is more than 30 knots
2712                    {
2713                        if (speed < 15)
2714                            distance = (int) (distanceScaler * 0.25)/15 * speed;
2715                        else if (speed < 30)
2716                            distance = (int) (distanceScaler * 0.5)/30 * speed;
2717                        else
2718                            distance = (int) (distanceScaler * 0.75);
2719                    }
2720                    double radians = (angle * (Math.PI / 180));//convert degrees to radians
2721                    int x2 = (int) (symbolCenter.x + distance * Math.cos(radians));
2722                    int y2 = (int) (symbolCenter.y + distance * Math.sin(radians));
2723
2724                    slPath.lineTo(x2, y2);
2725                    slsvgPath.lineTo(x2, y2);
2726                    slBounds = slsvgPath.getBounds();
2727                    imageBounds.union(slBounds);
2728                }
2729
2730                if (sdi instanceof ImageInfo) {
2731                    Bitmap bmp = Bitmap.createBitmap((int) Math.ceil(imageBounds.width()), (int) Math.ceil(imageBounds.height()), Config.ARGB_8888);
2732                    Canvas ctx = new Canvas(bmp);
2733
2734                    int alpha = 1;
2735                    if (attributes.containsKey(MilStdAttributes.Alpha))
2736                        alpha = Integer.parseInt(attributes.get(MilStdAttributes.Alpha));
2737
2738
2739                    Paint slPaint = new Paint();
2740                    slPaint.setColor(Color.BLACK.toInt());
2741                    slPaint.setAlpha(alpha * 255);
2742                    slPaint.setStyle(Style.STROKE);
2743                    slPaint.setStrokeWidth(strokeWidth);
2744
2745
2746                    float offsetX = 0;
2747                    float offsetY = 0;
2748                    if (imageBounds.left < 0)
2749                        offsetX = imageBounds.left * -1;
2750                    if (imageBounds.top < 0)
2751                        offsetY = imageBounds.top * -1;
2752
2753                    slPath.offset(offsetX,offsetY);
2754
2755                    ctx.drawBitmap(((ImageInfo) sdi).getImage(), offsetX, offsetY, null);
2756                    ctx.drawPath(slPath,slPaint);
2757
2758                    imageBounds.offset((int)offsetX,(int)offsetY);
2759                    symbolBounds.offset((int)offsetX,(int)offsetY);
2760                    symbolCenter.offset((int)offsetX,(int)offsetY);
2761
2762                    rsdi = new ImageInfo(bmp, symbolCenter, symbolBounds);
2763                }
2764                else if (sdi instanceof SVGSymbolInfo)
2765                {//public static String Convert(Shape shape,String stroke, String fill, String strokeWidth, String strokeOpacity, String fillOpacity, String dashArray, String lineCap)
2766                    String svg = ((SVGSymbolInfo) sdi).getSVG();
2767                    svg += slsvgPath.toSVGElement("#000000",strokeWidth,"none",1,1,null);
2768                    //svg += (Shape2SVG.Convert(slPath, "#000000", "none", String.valueOf(strokeWidth),null,null,null, null));
2769                    rsdi = new SVGSymbolInfo(svg,symbolCenter,symbolBounds,imageBounds);
2770                }
2771            }
2772        }
2773        catch(Exception exc)
2774        {
2775            ErrorLogger.LogException("ModifierRenderer","processSpeedLineIndicator",exc);
2776        }
2777
2778        return rsdi;
2779    }
2780
2781    /**
2782     * uses 2525C layout which shows most modifiers
2783     * @param sdi
2784     * @param symbolID
2785     * @param modifiers
2786     * @param attributes
2787     * @return
2788     */
2789    public static SymbolDimensionInfo processUnknownTextModifiers(SymbolDimensionInfo sdi, String symbolID, Map<String,String> modifiers, Map<String,String> attributes)
2790    {
2791        Paint modifierFont = getFont(attributes);
2792        float[] hd = getFontHeightandDescent(modifierFont);
2793        float modifierFontHeight = hd[0];
2794        float modifierFontDescent = hd[1];
2795
2796        String modifierFontName = RendererSettings.getInstance().getModiferFontProps()[0];
2797        if(attributes != null && attributes.containsKey(MilStdAttributes.FontFamily))
2798        {
2799            String temp = attributes.get(MilStdAttributes.FontFamily);
2800            if(temp != null && !temp.isEmpty())
2801                modifierFontName = temp;
2802        }
2803
2804        int bufferHorizontal = (int)modifierFontHeight/2;
2805        int bufferXL = bufferHorizontal;
2806        int bufferXR = bufferHorizontal;
2807        int bufferY = 2;
2808        int bufferText = 2;
2809        int x = 0;
2810        int y = 0;//best y
2811
2812        SymbolDimensionInfo  newsdi = null;
2813
2814        ArrayList<TextInfo> tiArray = new ArrayList<TextInfo>(modifiers.size());
2815
2816        int descent = (int) (modifierFontDescent + 0.5);
2817
2818        Rect labelBounds = null;
2819        int labelWidth, labelHeight;
2820
2821        Rect bounds = new Rect(sdi.getSymbolBounds());
2822        Rect symbolBounds = new Rect(sdi.getSymbolBounds());
2823        Point centerPoint = new Point(sdi.getCenterPoint());
2824        Rect imageBounds = new Rect(sdi.getImageBounds());
2825
2826        int echelon = SymbolID.getAmplifierDescriptor(symbolID);
2827        String echelonText = SymbolUtilities.getEchelonText(echelon);
2828        String amText = SymbolUtilities.getStandardIdentityModifier(symbolID);
2829        int mobility = SymbolID.getAmplifierDescriptor(symbolID);
2830
2831        //adjust width of bounds for mobility/echelon/engagement bar which could be wider than the symbol
2832        bounds = RectUtilities.makeRect(imageBounds.left, bounds.top, imageBounds.width(), bounds.height());
2833
2834
2835        //check if text is too tall:
2836        boolean byLabelHeight = false;
2837        labelHeight = (int) (modifierFontHeight + 0.5);/* RendererUtilities.measureTextHeight(RendererSettings.getModifierFontName(),
2838         RendererSettings.getModifierFontSize(),
2839         RendererSettings.getModifierFontStyle()).fullHeight;*/
2840
2841        int maxHeight = (bounds.height());
2842        if ((labelHeight * 3) > maxHeight)
2843        {
2844            byLabelHeight = true;
2845        }
2846
2847        //Affiliation Modifier being drawn as a display modifier
2848        String affiliationModifier = null;
2849        if (RS.getDrawAffiliationModifierAsLabel() == true)
2850        {
2851            affiliationModifier = SymbolUtilities.getStandardIdentityModifier(symbolID);
2852        }
2853        if (affiliationModifier != null)
2854        {   //Set affiliation modifier
2855            modifiers.put(Modifiers.E_FRAME_SHAPE_MODIFIER, affiliationModifier);
2856            //modifiers[Modifiers.E_FRAME_SHAPE_MODIFIER] = affiliationModifier;
2857        }//*/
2858
2859
2860        //            int y0 = 0;//W            E/F
2861        //            int y1 = 0;//X/Y          G
2862        //            int y2 = 0;//V/AD/AE      H/AF
2863        //            int y3 = 0;//T            M CC
2864        //            int y4 = 0;//Z            J/K/L/N/P
2865        //
2866
2867        // <editor-fold defaultstate="collapsed" desc="Build Modifiers">
2868        String modifierValue = null;
2869        TextInfo tiTemp = null;
2870        //if(Modifiers.C_QUANTITY in modifiers
2871        if (modifiers.containsKey(Modifiers.C_QUANTITY)
2872                && SymbolUtilities.canSymbolHaveModifier(symbolID, Modifiers.C_QUANTITY))
2873        {
2874            String text = modifiers.get(Modifiers.C_QUANTITY);
2875            if(text != null)
2876            {
2877                    //bounds = armyc2.c5isr.renderer.utilities.RendererUtilities.getTextOutlineBounds(modifierFont, text, new SO.Point(0,0));
2878                    tiTemp = new TextInfo(text, 0, 0, modifierFont, modifierFontName);
2879                    labelBounds = tiTemp.getTextBounds();
2880                    labelWidth = labelBounds.width();
2881                    x = Math.round((symbolBounds.left + (symbolBounds.width() * 0.5f)) - (labelWidth * 0.5f));
2882                    y = Math.round(symbolBounds.top - bufferY - descent);
2883                    tiTemp.setLocation(x, y);
2884                    tiArray.add(tiTemp);
2885            }
2886        }
2887
2888        //if(Modifiers.X_ALTITUDE_DEPTH in modifiers || Modifiers.Y_LOCATION in modifiers)
2889        if (modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION))
2890        {
2891            modifierValue = null;
2892
2893            String xm = null,
2894                    ym = null;
2895
2896            if (modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) && SymbolUtilities.canSymbolHaveModifier(symbolID, Modifiers.X_ALTITUDE_DEPTH))
2897            {
2898                xm = modifiers.get(Modifiers.X_ALTITUDE_DEPTH);// xm = modifiers.X;
2899            }
2900            if (modifiers.containsKey(Modifiers.Y_LOCATION))
2901            {
2902                ym = modifiers.get(Modifiers.Y_LOCATION);// ym = modifiers.Y;
2903            }
2904            if (xm == null && ym != null)
2905            {
2906                modifierValue = ym;
2907            }
2908            else if (xm != null && ym == null)
2909            {
2910                modifierValue = xm;
2911            }
2912            else if (xm != null && ym != null)
2913            {
2914                modifierValue = xm + "  " + ym;
2915            }
2916
2917            if(modifierValue != null)
2918            {
2919                    tiTemp = new TextInfo(modifierValue, 0, 0, modifierFont, modifierFontName);
2920                    labelBounds = tiTemp.getTextBounds();
2921                    labelWidth = labelBounds.width();
2922        
2923                    if (!byLabelHeight)
2924                    {
2925                        x = bounds.left - labelBounds.width() - bufferXL;
2926                        y = bounds.top + labelHeight - descent;
2927                    }
2928                    else
2929                    {
2930                        x = bounds.left - labelBounds.width() - bufferXL;
2931        
2932                        y = (bounds.height());
2933                        y = (int) ((y * 0.5) + (labelHeight * 0.5));
2934        
2935                        y = y - ((labelHeight + bufferText));
2936                        y = bounds.top + y;
2937                    }
2938        
2939                    tiTemp.setLocation(x, y);
2940                    tiArray.add(tiTemp);
2941            }
2942        }
2943
2944        if (modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) )
2945        {
2946            modifierValue = modifiers.get(Modifiers.G_STAFF_COMMENTS);
2947
2948            if(modifierValue != null)
2949            {
2950                    tiTemp = new TextInfo(modifierValue, 0, 0, modifierFont, modifierFontName);
2951                    labelBounds = tiTemp.getTextBounds();
2952                    labelWidth = labelBounds.width();
2953        
2954                    x = bounds.left + bounds.width() + bufferXR;
2955                    if (!byLabelHeight)
2956                    {
2957                        y = bounds.top + labelHeight - descent;
2958                    }
2959                    else
2960                    {
2961                        y = (bounds.height());
2962                        y = (int) ((y * 0.5) + (labelHeight * 0.5));
2963        
2964                        y = y - ((labelHeight + bufferText));
2965                        y = bounds.top + y;
2966                    }
2967        
2968                    tiTemp.setLocation(x, y);
2969                    tiArray.add(tiTemp);
2970
2971            }
2972        }
2973
2974        if ((modifiers.containsKey(Modifiers.V_EQUIP_TYPE)) ||
2975                (modifiers.containsKey(Modifiers.AD_PLATFORM_TYPE)) ||
2976                (modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME)))
2977        {
2978            String vm = null,
2979                    adm = null,
2980                    aem = null;
2981
2982            if (modifiers.containsKey(Modifiers.V_EQUIP_TYPE) && SymbolUtilities.canSymbolHaveModifier(symbolID, Modifiers.V_EQUIP_TYPE))
2983            {
2984                vm = modifiers.get(Modifiers.V_EQUIP_TYPE);
2985            }
2986            if (modifiers.containsKey(Modifiers.AD_PLATFORM_TYPE) && SymbolUtilities.canSymbolHaveModifier(symbolID, Modifiers.AD_PLATFORM_TYPE))
2987            {
2988                adm = modifiers.get(Modifiers.AD_PLATFORM_TYPE);
2989            }
2990            if (modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME) && SymbolUtilities.canSymbolHaveModifier(symbolID, Modifiers.AE_EQUIPMENT_TEARDOWN_TIME))
2991            {
2992                aem = modifiers.get(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME);
2993            }
2994
2995            modifierValue = "";
2996            if(vm != null && vm.equals("") == false)
2997                modifierValue = vm;
2998            if(adm != null && adm.equals("") == false)
2999                modifierValue += " " + adm;
3000            if(aem != null && aem.equals("") == false)
3001                modifierValue += " " + aem;
3002
3003            if(modifierValue != null)
3004                modifierValue = modifierValue.trim();
3005            if(modifierValue != null && modifierValue.equals("") == false)
3006            {
3007                    tiTemp = new TextInfo(modifierValue, 0, 0, modifierFont, modifierFontName);
3008                    labelBounds = tiTemp.getTextBounds();
3009                    labelWidth = labelBounds.width();
3010        
3011                    x = bounds.left - labelBounds.width() - bufferXL;
3012        
3013                    y = (bounds.height());
3014                    y = (int) ((y * 0.5f) + ((labelHeight - descent) * 0.5f));
3015                    y = bounds.top + y;
3016        
3017                    tiTemp.setLocation(x, y);
3018                    tiArray.add(tiTemp);
3019            }
3020        }
3021
3022        if (modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1) || modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
3023        {
3024            modifierValue = "";
3025            String hm = "",
3026                    afm = "";
3027
3028            hm = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
3029            if (modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
3030            {
3031                hm = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
3032            }
3033            if (modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER) && SymbolUtilities.canSymbolHaveModifier(symbolID, Modifiers.AF_COMMON_IDENTIFIER))
3034            {
3035                afm = modifiers.get(Modifiers.AF_COMMON_IDENTIFIER);
3036            }
3037
3038            modifierValue = hm + " " + afm;
3039            modifierValue = modifierValue.trim();
3040
3041            if(modifierValue != null && modifierValue.equals("") == false)
3042            {
3043                    tiTemp = new TextInfo(modifierValue, 0, 0, modifierFont, modifierFontName);
3044                    labelBounds = tiTemp.getTextBounds();
3045                    labelWidth = labelBounds.width();
3046        
3047                    x = bounds.left + bounds.width() + bufferXR;
3048        
3049                    y = (bounds.height());
3050                    y = (int) ((y * 0.5) + ((labelHeight - descent) * 0.5));
3051                    y = bounds.top + y;
3052        
3053                    tiTemp.setLocation(x, y);
3054                    tiArray.add(tiTemp);
3055
3056            }
3057        }
3058
3059        if (modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
3060        {
3061            modifierValue = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
3062
3063            if(modifierValue != null)
3064            {
3065                    tiTemp = new TextInfo(modifierValue, 0, 0, modifierFont, modifierFontName);
3066                    labelBounds = tiTemp.getTextBounds();
3067                    labelWidth = labelBounds.width();
3068        
3069                    if (!byLabelHeight)
3070                    {
3071                        x = bounds.left - labelWidth - bufferXL;
3072                        y = bounds.top + bounds.height();
3073                    }
3074                    else
3075                    {
3076                        x = bounds.left - labelWidth - bufferXL;
3077        
3078                        y = (bounds.height());
3079                        y = (int) ((y * 0.5) + (labelHeight * 0.5));
3080        
3081                        y = y + ((labelHeight + bufferText) - descent);
3082                        y = bounds.top + y;
3083                    }
3084        
3085                    tiTemp.setLocation(x, y);
3086                    tiArray.add(tiTemp);
3087            }
3088        }
3089
3090        if (modifiers.containsKey(Modifiers.M_HIGHER_FORMATION) || modifiers.containsKey(Modifiers.AS_COUNTRY))
3091        {
3092            modifierValue = "";
3093
3094            if (modifiers.containsKey(Modifiers.M_HIGHER_FORMATION) && SymbolUtilities.canSymbolHaveModifier(symbolID, Modifiers.M_HIGHER_FORMATION))
3095            {
3096                modifierValue += modifiers.get(Modifiers.M_HIGHER_FORMATION);
3097            }
3098            if (modifiers.containsKey(Modifiers.AS_COUNTRY))
3099            {
3100                if (modifierValue.length() > 0)
3101                {
3102                    modifierValue += " ";
3103                }
3104                modifierValue += modifiers.get(Modifiers.AS_COUNTRY);
3105            }
3106
3107            if(modifierValue.equals("")==false)
3108            {
3109                tiTemp = new TextInfo(modifierValue, 0, 0, modifierFont, modifierFontName);
3110                labelBounds = tiTemp.getTextBounds();
3111                labelWidth = labelBounds.width();
3112
3113                x = bounds.left + bounds.width() + bufferXR;
3114                if (!byLabelHeight)
3115                {
3116                    y = bounds.top + bounds.height();
3117                }
3118                else
3119                {
3120                    y = (bounds.height());
3121                    y = (int) ((y * 0.5) + (labelHeight * 0.5));
3122
3123                    y = y + ((labelHeight + bufferText - descent));
3124                    y = bounds.top + y;
3125                }
3126
3127                tiTemp.setLocation(x, y);
3128                tiArray.add(tiTemp);
3129
3130            }
3131        }
3132
3133        if (modifiers.containsKey(Modifiers.Z_SPEED) )
3134        {
3135            modifierValue = modifiers.get(Modifiers.Z_SPEED);
3136
3137            if(modifierValue != null)
3138            {
3139                    tiTemp = new TextInfo(modifierValue, 0, 0, modifierFont, modifierFontName);
3140                    labelBounds = tiTemp.getTextBounds();
3141                    labelWidth = labelBounds.width();
3142        
3143                    x = bounds.left - labelWidth - bufferXL;
3144                    if (!byLabelHeight)
3145                    {
3146                        y = Math.round(bounds.top + bounds.height() + labelHeight + bufferText);
3147                    }
3148                    else
3149                    {
3150                        y = (bounds.height());
3151                        y = (int) ((y * 0.5) + (labelHeight * 0.5));
3152        
3153                        y = y + ((labelHeight + bufferText) * 2) - (descent * 2);
3154                        y = Math.round(bounds.top + y);
3155                    }
3156        
3157                    tiTemp.setLocation(x, y);
3158                    tiArray.add(tiTemp);
3159            }
3160        }
3161
3162        if (modifiers.containsKey(Modifiers.J_EVALUATION_RATING)
3163                || modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS)//
3164                || modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP)//
3165                || modifiers.containsKey(Modifiers.N_HOSTILE)//
3166                || modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))//
3167        {
3168            modifierValue = null;
3169
3170            String jm = null,
3171                    km = null,
3172                    lm = null,
3173                    nm = null,
3174                    pm = null;
3175
3176            if (modifiers.containsKey(Modifiers.J_EVALUATION_RATING))
3177            {
3178                jm = modifiers.get(Modifiers.J_EVALUATION_RATING);
3179            }
3180            if (modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS) && SymbolUtilities.canSymbolHaveModifier(symbolID, Modifiers.K_COMBAT_EFFECTIVENESS))
3181            {
3182                km = modifiers.get(Modifiers.K_COMBAT_EFFECTIVENESS);
3183            }
3184            if (modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP) && SymbolUtilities.canSymbolHaveModifier(symbolID, Modifiers.L_SIGNATURE_EQUIP))
3185            {
3186                lm = modifiers.get(Modifiers.L_SIGNATURE_EQUIP);
3187            }
3188            if (modifiers.containsKey(Modifiers.N_HOSTILE) && SymbolUtilities.canSymbolHaveModifier(symbolID, Modifiers.N_HOSTILE))
3189            {
3190                nm = modifiers.get(Modifiers.N_HOSTILE);
3191            }
3192            if (modifiers.containsKey(Modifiers.P_IFF_SIF_AIS) && SymbolUtilities.canSymbolHaveModifier(symbolID, Modifiers.P_IFF_SIF_AIS))
3193            {
3194                pm = modifiers.get(Modifiers.P_IFF_SIF_AIS);
3195            }
3196
3197            modifierValue = "";
3198            if (jm != null && jm.equals("") == false)
3199            {
3200                modifierValue = modifierValue + jm;
3201            }
3202            if (km != null && km.equals("") == false)
3203            {
3204                modifierValue = modifierValue + " " + km;
3205            }
3206            if (lm != null && lm.equals("") == false)
3207            {
3208                modifierValue = modifierValue + " " + lm;
3209            }
3210            if (nm != null && nm.equals("") == false)
3211            {
3212                modifierValue = modifierValue + " " + nm;
3213            }
3214            if (pm != null && pm.equals("") == false)
3215            {
3216                modifierValue = modifierValue + " " + pm;
3217            }
3218
3219            if (modifierValue.length() > 2 && modifierValue.charAt(0) == ' ')
3220            {
3221                modifierValue = modifierValue.substring(1);
3222            }
3223
3224            modifierValue = modifierValue.trim();
3225
3226            if(modifierValue.equals("")==false)
3227            {
3228                tiTemp = new TextInfo(modifierValue, 0, 0, modifierFont, modifierFontName);
3229                labelBounds = tiTemp.getTextBounds();
3230                labelWidth = labelBounds.width();
3231
3232                x = bounds.left + bounds.width() + bufferXR;
3233                if (!byLabelHeight)
3234                {
3235                    y = Math.round(bounds.top + bounds.height() + labelHeight + bufferText);
3236                }
3237                else
3238                {
3239                    y = (bounds.height());
3240                    y = (int) ((y * 0.5) + (labelHeight * 0.5));
3241
3242                    y = y + ((labelHeight + bufferText) * 2) - (descent * 2);
3243                    y = Math.round(bounds.top + y);
3244                }
3245
3246                tiTemp.setLocation(x, y);
3247                tiArray.add(tiTemp);
3248
3249            }
3250
3251        }
3252
3253        if (modifiers.containsKey(Modifiers.W_DTG_1))
3254        {
3255            modifierValue = modifiers.get(Modifiers.W_DTG_1);
3256
3257            if(modifierValue != null)
3258            {
3259                    tiTemp = new TextInfo(modifierValue, 0, 0, modifierFont, modifierFontName);
3260                    labelBounds = tiTemp.getTextBounds();
3261                    labelWidth = labelBounds.width();
3262        
3263                    if (!byLabelHeight)
3264                    {
3265                        x = bounds.left - labelWidth - bufferXL;
3266                        y = bounds.top - bufferY - descent;
3267                    }
3268                    else
3269                    {
3270                        x = bounds.left - labelWidth - bufferXL;
3271        
3272                        y = (bounds.height());
3273                        y = (int) ((y * 0.5) + (labelHeight * 0.5));
3274        
3275                        y = y - ((labelHeight + bufferText) * 2);
3276                        y = bounds.top + y;
3277                    }
3278        
3279                    tiTemp.setLocation(x, y);
3280                    tiArray.add(tiTemp);
3281            }
3282        }
3283
3284        if (modifiers.containsKey(Modifiers.F_REINFORCED_REDUCED) || modifiers.containsKey(Modifiers.E_FRAME_SHAPE_MODIFIER))
3285        {
3286            modifierValue = null;
3287            String E = null,
3288                    F = null;
3289
3290            if (modifiers.containsKey(Modifiers.E_FRAME_SHAPE_MODIFIER))
3291            {
3292                E = modifiers.get(Modifiers.E_FRAME_SHAPE_MODIFIER);
3293                modifiers.remove(Modifiers.E_FRAME_SHAPE_MODIFIER);
3294            }
3295            if (modifiers.containsKey(Modifiers.F_REINFORCED_REDUCED) && SymbolUtilities.canSymbolHaveModifier(symbolID, Modifiers.F_REINFORCED_REDUCED))
3296            {
3297                F = modifiers.get(Modifiers.F_REINFORCED_REDUCED);
3298            }
3299
3300            if (E != null && E.equals("") == false)
3301            {
3302                modifierValue = E;
3303            }
3304
3305            if (F != null && F.equals("") == false)
3306            {
3307                if (F.toUpperCase(Locale.US) == ("R"))
3308                {
3309                    F = "(+)";
3310                }
3311                else if (F.toUpperCase(Locale.US) == ("D"))
3312                {
3313                    F = "(-)";
3314                }
3315                else if (F.toUpperCase(Locale.US) == ("RD"))
3316                {
3317                    F = "(" + (char) (177) + ")";
3318                }
3319            }
3320
3321            if (F != null && F.equals("") == false)
3322            {
3323                if (modifierValue != null && modifierValue.equals("") == false)
3324                {
3325                    modifierValue = modifierValue + " " + F;
3326                }
3327                else
3328                {
3329                    modifierValue = F;
3330                }
3331            }
3332
3333            if(modifierValue != null)
3334            {
3335                    tiTemp = new TextInfo(modifierValue, 0, 0, modifierFont, modifierFontName);
3336                    labelBounds = tiTemp.getTextBounds();
3337                    labelWidth = labelBounds.width();
3338        
3339                    if (!byLabelHeight)
3340                    {
3341                        x = bounds.left + bounds.width() + bufferXR;
3342                        y = bounds.top - bufferY - descent;
3343                    }
3344                    else
3345                    {
3346                        x = bounds.left + bounds.width() + bufferXR;
3347        
3348                        y = (bounds.height());
3349                        y = (int) ((y * 0.5) + (labelHeight * 0.5));
3350        
3351                        y = y - ((labelHeight + bufferText) * 2);
3352                        y = bounds.top + y;
3353                    }
3354        
3355                    tiTemp.setLocation(x, y);
3356                    tiArray.add(tiTemp);
3357
3358            }
3359        }
3360
3361        if (modifiers.containsKey(Modifiers.AA_SPECIAL_C2_HQ) && SymbolUtilities.canSymbolHaveModifier(symbolID, Modifiers.AA_SPECIAL_C2_HQ))
3362        {
3363            modifierValue = modifiers.get(Modifiers.AA_SPECIAL_C2_HQ);
3364
3365            if(modifierValue != null)
3366            {
3367                    tiTemp = new TextInfo(modifierValue, 0, 0, modifierFont, modifierFontName);
3368                    labelBounds = tiTemp.getTextBounds();
3369                    labelWidth = labelBounds.width();
3370        
3371                    x = (int) ((symbolBounds.left + (symbolBounds.width() * 0.5f)) - (labelWidth * 0.5f));
3372        
3373                    y = (symbolBounds.height());//checkpoint, get box above the point
3374                    y = (int) ((y * 0.5) + ((labelHeight - descent) * 0.5));
3375                    y = symbolBounds.top + y;
3376        
3377                    tiTemp.setLocation(x, y);
3378                    tiArray.add(tiTemp);
3379            }
3380        }
3381
3382
3383        // </editor-fold>
3384
3385        //Shift Points and Draw
3386        newsdi = shiftUnitPointsAndDraw(tiArray,sdi,attributes, modifierFont);
3387
3388        // <editor-fold defaultstate="collapsed" desc="Cleanup">
3389        tiArray = null;
3390        tiTemp = null;
3391        //tempShape = null;
3392        //ctx = null;
3393        //buffer = null;
3394        // </editor-fold>
3395
3396        return newsdi;
3397    }
3398
3399
3400    public static SymbolDimensionInfo  processSPTextModifiers(SymbolDimensionInfo sdi, String symbolID, Map<String,String> modifiers, Map<String,String> attributes)
3401    {
3402        Paint modifierFont = getFont(attributes);
3403        float[] hd = getFontHeightandDescent(modifierFont);
3404        float modifierFontHeight = hd[0];
3405        float modifierFontDescent = hd[1];
3406
3407        String modifierFontName = RendererSettings.getInstance().getModiferFontProps()[0];
3408        if(attributes != null && attributes.containsKey(MilStdAttributes.FontFamily))
3409        {
3410            String temp = attributes.get(MilStdAttributes.FontFamily);
3411            if(temp != null && !temp.isEmpty())
3412                modifierFontName = temp;
3413        }
3414
3415        int bufferXL = 7;
3416        int bufferXR = 7;
3417        int bufferY = 2;
3418        int bufferText = 2;
3419        int x = 0;
3420        int y = 0;//best y
3421        SymbolDimensionInfo newsdi = null;
3422
3423        ArrayList<TextInfo> tiArray = new ArrayList<TextInfo>(modifiers.size());
3424
3425        int descent = (int) (modifierFontDescent + 0.5);
3426
3427
3428        Rect labelBounds = null;
3429        int labelWidth, labelHeight;
3430
3431        Rect bounds = new Rect(sdi.getSymbolBounds());
3432        Rect symbolBounds = new Rect(sdi.getSymbolBounds());
3433        Rect imageBounds = new Rect(sdi.getImageBounds());
3434
3435        //adjust width of bounds for mobility/echelon/engagement bar which could be wider than the symbol
3436        bounds = RectUtilities.makeRect(imageBounds.left, bounds.top, imageBounds.width(), bounds.height());
3437
3438        labelHeight = (int) (modifierFontHeight + 0.5);
3439
3440        //Affiliation Modifier being drawn as a display modifier
3441        String affiliationModifier = null;
3442        if (RS.getDrawAffiliationModifierAsLabel() == true)
3443        {
3444            affiliationModifier = SymbolUtilities.getStandardIdentityModifier(symbolID);
3445        }
3446        if (affiliationModifier != null)
3447        {   //Set affiliation modifier
3448            modifiers.put(Modifiers.E_FRAME_SHAPE_MODIFIER, affiliationModifier);
3449            //modifiers[Modifiers.E_FRAME_SHAPE_MODIFIER] = affiliationModifier;
3450        }//*/
3451
3452        //Check for Valid Country Code
3453        int cc = SymbolID.getCountryCode(symbolID);
3454        String scc = "";
3455        if(cc > 0)
3456        {
3457            scc = GENCLookup.getInstance().get3CharCode(cc);
3458        }
3459        if(!scc.isEmpty())
3460            modifiers.put(Modifiers.AS_COUNTRY, scc);
3461
3462        // <editor-fold defaultstate="collapsed" desc="Build Modifiers">
3463        String modifierValue = null;
3464        TextInfo tiTemp = null;
3465
3466
3467        List<Modifier> mods = getLabelPositionIndexes(symbolID, modifiers, attributes);
3468
3469        Modifier mod = null;
3470        if(mods != null) {
3471            for (int i = 0; i < mods.size(); i++) {
3472                mod = mods.get(i);
3473
3474                tiTemp = new TextInfo(mod.getText(), 0, 0, modifierFont, modifierFontName);
3475                labelBounds = tiTemp.getTextBounds();
3476                labelWidth = (int) labelBounds.width();
3477
3478                //centered
3479                if(mod.getIndexX()==0)
3480                    x = (int) getLabelXPosition(symbolBounds, labelWidth, mod.getIndexX(), modifierFontHeight);
3481                else//on left
3482                    x = (int) getLabelXPosition(bounds, labelWidth, mod.getIndexX(), modifierFontHeight);
3483                //above center V
3484                y = (int) getLabelYPosition(bounds, labelHeight, descent, bufferText, mod.getCentered(), mod.getIndexY());
3485
3486                tiTemp.setLocation(x, y);
3487                tiArray.add(tiTemp);
3488            }
3489        }
3490
3491
3492        // </editor-fold>
3493
3494        //Shift Points and Draw
3495        newsdi = shiftUnitPointsAndDraw(tiArray,sdi,attributes, modifierFont);
3496
3497        // <editor-fold defaultstate="collapsed" desc="Cleanup">
3498        tiArray = null;
3499        tiTemp = null;
3500        //tempShape = null;
3501        //ctx = null;
3502        //buffer = null;
3503        // </editor-fold>
3504
3505        return newsdi;
3506    }
3507
3508    public static SymbolDimensionInfo ProcessTGSPWithSpecialModifierLayout(SymbolDimensionInfo sdi, String symbolID, Map<String,String> modifiers, Map<String,String> attributes, Color lineColor)
3509    {
3510        Paint modifierFont = getFont(attributes);
3511        float[] hd = getFontHeightandDescent(modifierFont);
3512        float modifierFontHeight = hd[0];
3513        float modifierFontDescent = hd[1];
3514
3515        String modifierFontName = RendererSettings.getInstance().getModiferFontProps()[0];
3516        if(attributes != null && attributes.containsKey(MilStdAttributes.FontFamily))
3517        {
3518            String temp = attributes.get(MilStdAttributes.FontFamily);
3519            if(temp != null && !temp.isEmpty())
3520                modifierFontName = temp;
3521        }
3522
3523        ImageInfo ii = null;
3524        SVGSymbolInfo ssi = null;
3525
3526        int bufferXL = 6;
3527        int bufferXR = 4;
3528        int bufferY = 2;
3529        int bufferText = 2;
3530        int centerOffset = 1; //getCenterX/Y function seems to go over by a pixel
3531        int x = 0;
3532        int y = 0;
3533        int x2 = 0;
3534        int y2 = 0;
3535
3536        int outlineOffset = RS.getTextOutlineWidth();
3537        int labelHeight = 0;
3538        int labelWidth = 0;
3539        int alpha = -1;
3540        SymbolDimensionInfo newsdi = null;
3541        Color textColor = lineColor;
3542        Color textBackgroundColor = null;
3543        int ss = SymbolID.getSymbolSet(symbolID);
3544        int ec = SymbolID.getEntityCode(symbolID);
3545        int e = SymbolID.getEntity(symbolID);
3546        int et = SymbolID.getEntityType(symbolID);
3547        int est = SymbolID.getEntitySubtype(symbolID);
3548
3549        //Feint Dummy Indicator variables
3550        Rect fdiBounds = null;
3551        Point fdiTop = null;
3552        Point fdiLeft = null;
3553        Point fdiRight = null;
3554
3555        ArrayList<TextInfo> arrMods = new ArrayList<TextInfo>();
3556        boolean duplicate = false;
3557
3558        Rect bounds = new Rect(sdi.getSymbolBounds());
3559        Rect symbolBounds = new Rect(sdi.getSymbolBounds());
3560        Point centerPoint = new Point(sdi.getCenterPoint());
3561        Rect imageBounds = new Rect(sdi.getImageBounds());
3562
3563        if (attributes.containsKey(MilStdAttributes.Alpha))
3564        {
3565            alpha = Integer.parseInt(attributes.get(MilStdAttributes.Alpha));
3566            textColor.setAlpha(alpha);
3567        }
3568
3569        centerPoint = new Point(Math.round(sdi.getCenterPoint().x), Math.round(sdi.getCenterPoint().y));
3570
3571        boolean byLabelHeight = false;
3572        labelHeight = (int) (modifierFontHeight + 0.5f);
3573
3574        int maxHeight = (symbolBounds.height());
3575        if ((labelHeight * 3) > maxHeight)
3576        {
3577            byLabelHeight = true;
3578        }
3579
3580        int descent = (int) (modifierFontDescent + 0.5f);
3581        int yForY = -1;
3582
3583        Rect labelBounds1 = null;//text.getPixelBounds(null, 0, 0);
3584        Rect labelBounds2 = null;
3585        String strText = "";
3586        String strText1 = "";
3587        String strText2 = "";
3588        TextInfo text1 = null;
3589        TextInfo text2 = null;
3590
3591
3592        if (outlineOffset > 2)
3593        {
3594            outlineOffset = ((outlineOffset - 1) / 2);
3595        }
3596        else
3597        {
3598            outlineOffset = 0;
3599        }
3600
3601        //Check for Valid Country Code
3602        int cc = SymbolID.getCountryCode(symbolID);
3603        String scc = "";
3604        if(cc > 0)
3605        {
3606            scc = GENCLookup.getInstance().get3CharCode(cc);
3607        }
3608        if(!scc.isEmpty())
3609            modifiers.put(Modifiers.AS_COUNTRY, scc);
3610
3611        // <editor-fold defaultstate="collapsed" desc="Process Special Modifiers">
3612        TextInfo ti = null;
3613        if (SymbolUtilities.isCBRNEvent(symbolID))//chemical
3614        {
3615            if ((labelHeight * 3) > bounds.height())
3616            {
3617                byLabelHeight = true;
3618            }
3619        }
3620
3621        if(ss == SymbolID.SymbolSet_ControlMeasure) {
3622            if (ec == 130500) //contact point
3623            {
3624                if (modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)) {
3625                    strText = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
3626                    if (strText != null) {
3627                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3628                        labelWidth = Math.round(ti.getTextBounds().width());
3629                        //One modifier symbols and modifier goes in center
3630                        x = bounds.left + (int) (bounds.width() * 0.5f);
3631                        x = x - (int) (labelWidth * 0.5f);
3632                        y = bounds.top + (int) (bounds.height() * 0.4f);
3633                        y = y + (int) (labelHeight * 0.5f);
3634
3635                        ti.setLocation(Math.round(x), Math.round(y));
3636                        arrMods.add(ti);
3637                    }
3638                }
3639                if (modifiers.containsKey(Modifiers.W_DTG_1)) {
3640                    strText = modifiers.get(Modifiers.W_DTG_1);
3641                    if (strText != null) {
3642                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3643                        labelWidth = ti.getTextBounds().width();
3644
3645                        x = (bounds.left - labelWidth - bufferXL);
3646                        y = (bounds.top + labelHeight - descent);
3647
3648                        ti.setLocation(x, y);
3649                        arrMods.add(ti);
3650                    }
3651                }
3652            }
3653            else if (ec == 130700) //decision point
3654            {
3655                if (modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)) {
3656
3657                    strText = "";
3658                    if (modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
3659                        strText += modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
3660                    if (modifiers.containsKey(Modifiers.AS_COUNTRY))
3661                        strText += " " + modifiers.get(Modifiers.AS_COUNTRY);
3662                    strText = strText.trim();
3663
3664                    if (!strText.isEmpty()) {
3665                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3666                        labelWidth = Math.round(ti.getTextBounds().width());
3667                        //One modifier symbols and modifier goes in center
3668                        x = bounds.left + (int) (bounds.width() * 0.5f);
3669                        x = x - (int) (labelWidth * 0.5f);
3670                        y = bounds.top + (int) (bounds.height() * 0.5f);
3671                        y = y + (int) (labelHeight * 0.5f);
3672
3673                        ti.setLocation(Math.round(x), Math.round(y));
3674                        arrMods.add(ti);
3675                    }
3676                }
3677            }
3678            else if (ec == 212800)//harbor
3679            {
3680                if (modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1)) {
3681                    strText = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
3682                    if (strText != null) {
3683                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3684                        labelWidth = Math.round(ti.getTextBounds().width());
3685                        //One modifier symbols and modifier goes in center
3686                        x = bounds.left + (int) (bounds.width() * 0.5f);
3687                        x = x - (int) (labelWidth * 0.5f);
3688                        y = bounds.top + (int) (bounds.height() * 0.5f);
3689                        y = y + (int) (labelHeight * 0.5f);
3690
3691                        ti.setLocation(Math.round(x), Math.round(y));
3692                        arrMods.add(ti);
3693                    }
3694                }
3695            } else if (ec == 131300)//point of interest
3696            {
3697                if (modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)) {
3698                    strText = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
3699                    if (strText != null) {
3700                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3701                        labelWidth = Math.round(ti.getTextBounds().width());
3702                        //One modifier symbols, top third & center
3703                        x = bounds.left + (int) (bounds.width() * 0.5f);
3704                        x = x - (int) (labelWidth * 0.5f);
3705                        y = bounds.top + (int) (bounds.height() * 0.25f);
3706                        y = y + (int) (labelHeight * 0.5f);
3707
3708                        ti.setLocation(Math.round(x), Math.round(y));
3709                        arrMods.add(ti);
3710                    }
3711                }
3712            } else if (ec == 131800//waypoint
3713                    || ec == 240900)//fire support station
3714            {
3715                if (modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)) {
3716                    strText = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
3717                    if (strText != null) {
3718                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3719
3720                        //One modifier symbols and modifier goes right of center
3721                        if (ec == 131800)
3722                            x = bounds.left + (int) (bounds.width() * 0.75f);
3723                        else
3724                            x = bounds.left + (bounds.width());
3725                        y = bounds.top + (int) (bounds.height() * 0.5f);
3726                        y = y + (int) ((labelHeight - descent) * 0.5f);
3727
3728                        ti.setLocation(Math.round(x), Math.round(y));
3729                        arrMods.add(ti);
3730                    }
3731                }
3732            }
3733            else if (ec == 131900)//Airfield (AEGIS Only)
3734            {
3735                if (modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)) {
3736                    strText = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
3737                    if (strText != null) {
3738                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3739
3740                        //One modifier symbols and modifier goes right of symbol
3741
3742                        x = bounds.left + (bounds.width() + bufferXR);
3743
3744                        y = bounds.top + (int) (bounds.height() * 0.5f);
3745                        y = y + (int) ((labelHeight - descent) * 0.5f);
3746
3747                        ti.setLocation(Math.round(x), Math.round(y));
3748                        arrMods.add(ti);
3749                    }
3750                }
3751            }
3752            else if (ec == 180100 //Air Control point
3753                    || ec == 180200) //Communications Check point
3754            {
3755                if (modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)) {
3756                    strText = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
3757                    if (strText != null) {
3758                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3759                        labelWidth = ti.getTextBounds().width();
3760                        //One modifier symbols and modifier goes just below of center
3761                        x = bounds.left + (int) (bounds.width() * 0.5);
3762                        x = x - (int) (labelWidth * 0.5);
3763                        y = bounds.top + (int) (bounds.height() * 0.5f);
3764                        y = y + (int) (((bounds.height() * 0.5f) - labelHeight) / 2) + labelHeight - descent;
3765
3766                        ti.setLocation(Math.round(x), Math.round(y));
3767                        arrMods.add(ti);
3768                    }
3769                }
3770            } else if (ec == 160300 || //T (target reference point)
3771                    ec == 132000 || //T (Target Handover)
3772                    ec == 240601 || //ap,ap1,x,h (Point/Single Target)
3773                    ec == 240602) //ap (nuclear target)
3774            { //Targets with special modifier positions
3775                if (modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1)
3776                        && ec == 240601)//H //point single target
3777                {
3778                    strText = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
3779                    if (strText != null) {
3780                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3781
3782                        x = RectUtilities.getCenterX(bounds) + (int) (bounds.width() * 0.15f);
3783                        y = bounds.top + (int) (bounds.height() * 0.75f);
3784                        y = y + (int) (labelHeight * 0.5f);
3785
3786                        ti.setLocation(Math.round(x), Math.round(y));
3787                        arrMods.add(ti);
3788                    }
3789                }
3790                if (modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH)
3791                        && ec == 240601)//X point or single target
3792                {
3793                    strText = modifiers.get(Modifiers.X_ALTITUDE_DEPTH);
3794                    if (strText != null) {
3795                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3796                        labelWidth = Math.round(ti.getTextBounds().width());
3797                        x = RectUtilities.getCenterX(bounds) - (int) (bounds.width() * 0.15f);
3798                        x = x - (labelWidth);
3799                        y = bounds.top + (int) (bounds.height() * 0.75f);
3800                        y = y + (int) (labelHeight * 0.5f);
3801
3802                        ti.setLocation(Math.round(x), Math.round(y));
3803                        arrMods.add(ti);
3804                    }
3805                }
3806                strText = null;
3807                if (modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1) && (ec == 160300 || ec == 132000)) {
3808                    strText = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
3809                    if (strText != null) {
3810                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3811
3812                        x = RectUtilities.getCenterX(bounds) + (int) (bounds.width() * 0.15f);
3813                        y = bounds.top + (int) (bounds.height() * 0.30f);
3814
3815                        ti.setLocation(Math.round(x), Math.round(y));
3816                        arrMods.add(ti);
3817                    }
3818                }
3819                if (ec == 240601 || ec == 240602)
3820                {
3821                    if (modifiers.containsKey(Modifiers.AP_TARGET_NUMBER)) {
3822                        strText = modifiers.get(Modifiers.AP_TARGET_NUMBER);
3823                    }
3824                    if (ec == 240601 && modifiers.containsKey(Modifiers.AP1_TARGET_NUMBER_EXTENSION)) {
3825                        if (strText != null)
3826                            strText = strText + "  " + modifiers.get(Modifiers.AP1_TARGET_NUMBER_EXTENSION);
3827                        else
3828                            strText = modifiers.get(Modifiers.AP1_TARGET_NUMBER_EXTENSION);
3829                    }
3830                    if (strText != null) {
3831                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3832
3833                        x = RectUtilities.getCenterX(bounds) + (int) (bounds.width() * 0.15f);
3834                        y = bounds.top + (int) (bounds.height() * 0.30f);
3835
3836                        ti.setLocation(Math.round(x), Math.round(y));
3837                        arrMods.add(ti);
3838                    }
3839                }
3840            }
3841            else if (ec == 213400 && SymbolID.getVersion(symbolID)==SymbolID.Version_APP6Ech2)  //Navigation Reference Point
3842            {
3843                if (modifiers.containsKey(Modifiers.W_DTG_1))
3844                {
3845                    strText = modifiers.get(Modifiers.W_DTG_1);
3846                    if (strText != null) {
3847                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3848
3849                        x = (int)(bounds.left + (bounds.width() * 0.75f));
3850                        y = (int)(bounds.top + (bounds.height() * 0.75f));
3851                        y = y + labelHeight;
3852
3853                        ti.setLocation(Math.round(x), Math.round(y));
3854                        arrMods.add(ti);
3855                    }
3856                }
3857                if (modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)) {
3858                    strText = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
3859                    if (strText != null) {
3860                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3861
3862                        x = (int)(bounds.left + (bounds.width() * 0.25f)-ti.getTextBounds().width());
3863                        y = (int)(bounds.top + (bounds.height() * 0.25f));
3864
3865                        ti.setLocation(Math.round(x), Math.round(y));
3866                        arrMods.add(ti);
3867                    }
3868                }
3869            }
3870            else if (ec == 132100)//Key Terrain
3871            {
3872                if (modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)) {
3873                    strText = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
3874                    if (strText != null) {
3875                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3876
3877                        //One modifier symbols and modifier goes right of symbol
3878
3879                        x = bounds.left + (int)(bounds.width() * 0.5) + bufferXL;
3880
3881                        y = bounds.top + (int) (bounds.height() * 0.5f);
3882                        y = y + (int) ((labelHeight - descent) * 0.5f);
3883
3884                        ti.setLocation(Math.round(x), Math.round(y));
3885                        arrMods.add(ti);
3886                    }
3887                }
3888            }
3889            else if (ec == 132300)  //Vital Ground
3890            {
3891                if (modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1)) {
3892                    strText = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
3893                    if (strText != null) {
3894                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3895
3896                        //One modifier symbols and modifier goes bottom right of symbol
3897                        x = (int)(bounds.left + (bounds.width() * 0.88f));
3898
3899                        y = (int)(bounds.top + (bounds.height() * 0.88f));
3900                        y = y + (labelHeight - descent);
3901
3902                        ti.setLocation(Math.round(x), Math.round(y));
3903                        arrMods.add(ti);
3904                    }
3905                }
3906            }
3907            else if(ec == 182600)//Isolated Personnel Location
3908            {
3909                if (modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1)) {
3910                    strText = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
3911                    if (strText != null) {
3912                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3913                        labelWidth = (int)Math.round(ti.getTextBounds().width());
3914
3915                        x = (int)(bounds.left + (bounds.width() * 0.5));
3916                        x = x - (int) (labelWidth * 0.5);
3917                        y = (int)bounds.top - descent;
3918                        ti.setLocation(Math.round(x), Math.round(y));
3919                        arrMods.add(ti);
3920                    }
3921                }
3922                if (modifiers.containsKey(Modifiers.W_DTG_1)) {
3923                    strText = modifiers.get(Modifiers.W_DTG_1);
3924                    if (strText != null) {
3925                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3926                        labelWidth = (int)Math.round(ti.getTextBounds().width());
3927
3928                        x = (int)bounds.left - labelWidth - bufferXL;
3929                        if (!byLabelHeight) {
3930                            y = (int)bounds.top + labelHeight - descent;
3931                        } else {
3932                            //y = bounds.y + ((bounds.getHeight * 0.5) + (labelHeight * 0.5) - (labelHeight + bufferText));
3933                            y = (int)(bounds.top + ((bounds.height() * 0.5) - ((labelHeight - descent) * 0.5) + (-descent - bufferText)));
3934                        }
3935
3936                        ti.setLocation(Math.round(x), Math.round(y));
3937                        arrMods.add(ti);
3938                    }
3939                }
3940                if (modifiers.containsKey(Modifiers.W1_DTG_2)) {
3941                    strText = modifiers.get(Modifiers.W1_DTG_2);
3942                    if (strText != null) {
3943                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3944                        labelWidth = (int)Math.round(ti.getTextBounds().width());
3945
3946                        x = (int)bounds.left - labelWidth - bufferXL;
3947                        if (!byLabelHeight) {
3948                            y = (int)bounds.top + labelHeight - descent;
3949                        } else {
3950                            //y = bounds.y + ((bounds.getHeight * 0.5) + (labelHeight * 0.5) - (labelHeight + bufferText));
3951                            y = (int)(bounds.top + ((bounds.height() * 0.5) - (((labelHeight * 2) - descent) * 0.5) + (-descent - bufferText)));
3952                        }
3953
3954                        ti.setLocation(Math.round(x), Math.round(y));
3955                        arrMods.add(ti);
3956                    }
3957                }
3958            }
3959            else if (SymbolUtilities.isCBRNEvent(symbolID)) //CBRN
3960            {
3961                if (modifiers.containsKey(Modifiers.N_HOSTILE)) {
3962                    strText = modifiers.get(Modifiers.N_HOSTILE);
3963                    if (strText != null) {
3964                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3965
3966                        x = bounds.left + bounds.width() + bufferXR;
3967
3968                        if (!byLabelHeight) {
3969                            y = bounds.top + bounds.height();
3970                        } else {
3971                            y = bounds.top + (int) ((bounds.height() * 0.5f) + ((labelHeight - descent) * 0.5) + (labelHeight - descent + bufferText));
3972                        }
3973
3974                        ti.setLocation(Math.round(x), Math.round(y));
3975                        arrMods.add(ti);
3976                    }
3977
3978                }
3979                if (modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1)) {
3980                    strText = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
3981                    if (strText != null) {
3982                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
3983
3984                        x = bounds.left + bounds.width() + bufferXR;
3985                        if (!byLabelHeight) {
3986                            y = bounds.top + labelHeight - descent;
3987                        } else {
3988                            //y = bounds.y + ((bounds.height * 0.5) + (labelHeight * 0.5) - (labelHeight + bufferText));
3989                            y = bounds.top + (int) ((bounds.height() * 0.5f) - ((labelHeight - descent) * 0.5) + (-descent - bufferText));
3990                        }
3991
3992                        ti.setLocation(Math.round(x), Math.round(y));
3993                        arrMods.add(ti);
3994                    }
3995                }
3996                if (modifiers.containsKey(Modifiers.W_DTG_1)) {
3997                    strText = modifiers.get(Modifiers.W_DTG_1);
3998                    if (strText != null) {
3999                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4000                        labelWidth = Math.round(ti.getTextBounds().width());
4001
4002                        x = bounds.left - labelWidth - bufferXL;
4003                        if (!byLabelHeight) {
4004                            y = bounds.top + labelHeight - descent;
4005                        } else {
4006                            //y = bounds.y + ((bounds.height * 0.5) + (labelHeight * 0.5) - (labelHeight + bufferText));
4007                            y = bounds.top + (int) ((bounds.height() * 0.5) - ((labelHeight - descent) * 0.5) + (-descent - bufferText));
4008                        }
4009
4010                        ti.setLocation(Math.round(x), Math.round(y));
4011                        arrMods.add(ti);
4012                    }
4013                }
4014                if ((ec == 281500 || ec == 281600) && modifiers.containsKey(Modifiers.V_EQUIP_TYPE)) {//nuclear event or nuclear fallout producing event
4015                    strText = modifiers.get(Modifiers.V_EQUIP_TYPE);
4016                    if (strText != null) {
4017                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4018
4019                        //subset of nbc, just nuclear
4020                        labelWidth = Math.round(ti.getTextBounds().width());
4021                        x = bounds.left - labelWidth - bufferXL;
4022                        y = bounds.top + (int) ((bounds.height() * 0.5) + ((labelHeight - descent) * 0.5));//((bounds.height / 2) - (labelHeight/2));
4023
4024                        ti.setLocation(Math.round(x), Math.round(y));
4025                        arrMods.add(ti);
4026                    }
4027                }
4028                if (modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)) {
4029                    strText = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
4030                    if (strText != null) {
4031                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4032                        labelWidth = Math.round(ti.getTextBounds().width());
4033                        x = bounds.left - labelWidth - bufferXL;
4034                        if (!byLabelHeight) {
4035                            y = bounds.top + bounds.height();
4036                        } else {
4037                            //y = bounds.y + ((bounds.height * 0.5) + ((labelHeight-descent) * 0.5) + (labelHeight + bufferText));
4038                            y = bounds.top + (int) ((bounds.height() * 0.5) + ((labelHeight - descent) * 0.5) + (labelHeight - descent + bufferText));
4039                        }
4040                        ti.setLocation(Math.round(x), Math.round(y));
4041                        arrMods.add(ti);
4042                    }
4043                }
4044                if (modifiers.containsKey(Modifiers.Y_LOCATION)) {
4045                    strText = modifiers.get(Modifiers.Y_LOCATION);
4046                    if (strText != null) {
4047                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4048                        labelWidth = Math.round(ti.getTextBounds().width());
4049                        //just NBC
4050                        //x = bounds.left + (bounds.width() * 0.5);
4051                        //x = x - (labelWidth * 0.5);
4052                        x = bounds.left + (int) (bounds.width() * 0.5f);
4053                        x = x - (int) (labelWidth * 0.5f);
4054
4055                        if (!byLabelHeight) {
4056                            y = bounds.top + bounds.height() + labelHeight - descent + bufferY;
4057                        } else {
4058                            y = bounds.top + (int) ((bounds.height() * 0.5) + ((labelHeight - descent) * 0.5) + ((labelHeight + bufferText) * 2) - descent);
4059
4060                        }
4061                        yForY = y + descent; //so we know where to start the DOM arrow.
4062                        ti.setLocation(Math.round(x), Math.round(y));
4063                        arrMods.add(ti);
4064                    }
4065
4066                }
4067                if (modifiers.containsKey(Modifiers.C_QUANTITY)) {
4068                    strText = modifiers.get(Modifiers.C_QUANTITY);
4069                    if (strText != null) {
4070                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4071                        labelWidth = Math.round(ti.getTextBounds().width());
4072                        //subset of NBC, just nuclear
4073                        x = bounds.left + (int) (bounds.width() * 0.5);
4074                        x = x - (int) (labelWidth * 0.5);
4075                        y = bounds.top - descent;
4076                        ti.setLocation(Math.round(x), Math.round(y));
4077                        arrMods.add(ti);
4078                    }
4079
4080                }
4081            }
4082            else if (ec == 270701)//static depiction
4083            {
4084                if (modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1)) {
4085                    strText = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
4086                    if (strText != null) {
4087                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4088                        labelWidth = Math.round(ti.getTextBounds().width());
4089                        x = bounds.left + (int) (bounds.width() * 0.5);
4090                        x = x - (int) (labelWidth * 0.5);
4091                        y = bounds.top - descent;// + (bounds.height * 0.5);
4092                        //y = y + (labelHeight * 0.5);
4093
4094                        ti.setLocation(Math.round(x), Math.round(y));
4095                        arrMods.add(ti);
4096                    }
4097
4098                }
4099                if (modifiers.containsKey(Modifiers.W_DTG_1)) {
4100                    strText = modifiers.get(Modifiers.W_DTG_1);
4101                    if (strText != null) {
4102                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4103                        labelWidth = Math.round(ti.getTextBounds().width());
4104                        x = bounds.left + (int) (bounds.width() * 0.5);
4105                        x = x - (int) (labelWidth * 0.5);
4106                        y = bounds.top + (bounds.height());
4107                        y = y + (labelHeight);
4108
4109                        ti.setLocation(Math.round(x), Math.round(y));
4110                        arrMods.add(ti);
4111                    }
4112                }
4113                if (modifiers.containsKey(Modifiers.N_HOSTILE)) {
4114                    strText = modifiers.get(Modifiers.N_HOSTILE);
4115                    if (strText != null) {
4116                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4117                        TextInfo ti2 = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4118                        labelWidth = Math.round(ti.getTextBounds().width());
4119                        x = bounds.left + (bounds.width()) + bufferXR;//right
4120                        //x = x + labelWidth;//- (labelBounds.width * 0.75);
4121
4122                        duplicate = true;
4123
4124                        x2 = bounds.left;//left
4125                        x2 = x2 - labelWidth - bufferXL;// - (labelBounds.width * 0.25);
4126
4127                        y = bounds.top + (int) (bounds.height() * 0.5);//center
4128                        y = y + (int) ((labelHeight - descent) * 0.5);
4129
4130                        y2 = y;
4131
4132                        ti.setLocation(Math.round(x), Math.round(y));
4133                        ti2.setLocation(Math.round(x2), Math.round(y2));
4134                        arrMods.add(ti);
4135                        arrMods.add(ti2);
4136                    }
4137                }
4138
4139            }
4140            else if(e == 21 && et == 35)//sonobuoys
4141            {
4142                boolean is2525E = (SymbolID.getVersion(symbolID) >= SymbolID.Version_2525E);
4143                //H sitting on center of circle to the right
4144                //T above H
4145                centerPoint = SymbolUtilities.getCMSymbolAnchorPoint(symbolID,RectUtilities.makeRectFFromRect(bounds));
4146                if (modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1)) {
4147                    strText = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
4148                    if (strText != null) {
4149                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4150                        TextInfo ti2 = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4151                        labelWidth = Math.round(ti.getTextBounds().width());
4152                        x = bounds.left + (bounds.width()) + bufferXR;//right
4153                        y = centerPoint.y;
4154
4155                        if(is2525E) {
4156                            x = x - (int)(bounds.width() * 0.2);
4157                            y = (int) (bounds.top + (bounds.height() / 2));
4158                        }
4159
4160                        ti.setLocation(Math.round(x), Math.round(y));
4161                        arrMods.add(ti);
4162                    }
4163                }
4164                if (est == 0 || est == 1 || est == 4 || est == 7 || est == 8 || est == 15) {
4165                    if (modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)) {
4166                        strText = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
4167                        if (strText != null) {
4168                            ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4169                            TextInfo ti2 = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4170                            labelWidth = Math.round(ti.getTextBounds().width());
4171                            x = (bounds.left + (bounds.width()) + bufferXR - (int)(bounds.width() * 0.2) );//right
4172                            y = centerPoint.y - labelHeight;
4173
4174                            if(is2525E) {
4175                                y = (bounds.top + (bounds.height() / 2)) - labelHeight;
4176                            }
4177
4178                            ti.setLocation(Math.round(x), Math.round(y));
4179                            arrMods.add(ti);
4180                        }
4181                    }
4182                }
4183            }
4184            else if(ec == 282001 || //tower, low
4185                    ec == 282002)   //tower, high
4186            {
4187                if (modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH)) {
4188                    strText = modifiers.get(Modifiers.X_ALTITUDE_DEPTH);
4189                    if (strText != null) {
4190                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4191                        labelWidth = Math.round(ti.getTextBounds().width());
4192                        if(SymbolID.getStatus(symbolID)==SymbolID.Status_Planned_Anticipated_Suspect)
4193                            x = bounds.left + (int) (bounds.width() * 0.9);
4194                        else
4195                            x = bounds.left + (int) (bounds.width() * 0.8);
4196                        y = bounds.top + labelHeight - descent;// + (bounds.height * 0.5);
4197                        //y = y + (labelHeight * 0.5);
4198
4199                        ti.setLocation(Math.round(x), Math.round(y));
4200                        arrMods.add(ti);
4201                    }
4202
4203                }
4204            }
4205            else if(ec == 180600)//TACAN
4206            {
4207                if (modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)) {
4208                    strText = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
4209                    if (strText != null) {
4210                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4211                        labelWidth = Math.round(ti.getTextBounds().width());
4212                        x = bounds.left + bounds.width() + bufferXR;
4213                        y = bounds.top + labelHeight;// + (bounds.height * 0.5);
4214                        //y = y + (labelHeight * 0.5);
4215
4216                        ti.setLocation(Math.round(x), Math.round(y));
4217                        arrMods.add(ti);
4218                    }
4219
4220                }
4221            }
4222            else if(ec == 210300)//Defended Asset
4223            {
4224                if (modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)) {
4225                    strText = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
4226                    if (strText != null) {
4227                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4228                        labelWidth = Math.round(ti.getTextBounds().width());
4229                        x = bounds.left - labelWidth - bufferXL;
4230                        y = bounds.top + labelHeight;// + (bounds.height * 0.5);
4231                        //y = y + (labelHeight * 0.5);
4232
4233                        ti.setLocation(Math.round(x), Math.round(y));
4234                        arrMods.add(ti);
4235                    }
4236
4237                }
4238            }
4239            else if(ec == 210600)//Air Detonation
4240            {
4241                if (modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH)) {
4242                    strText = modifiers.get(Modifiers.X_ALTITUDE_DEPTH);
4243                    if (strText != null) {
4244                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4245                        labelWidth = Math.round(ti.getTextBounds().width());
4246                        x = bounds.left + (bounds.width() + bufferXR);
4247                        y = bounds.top + labelHeight;// + (bounds.height * 0.5);
4248                        //y = y + (labelHeight * 0.5);
4249
4250                        ti.setLocation(Math.round(x), Math.round(y));
4251                        arrMods.add(ti);
4252                    }
4253
4254                }
4255            }
4256            else if(ec == 210800)//Impact Point
4257            {
4258                if (modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1)) {
4259                    strText = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
4260                    if (strText != null) {
4261                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4262                        labelWidth = Math.round(ti.getTextBounds().width());
4263                        x = bounds.left + (int) (bounds.width() * 0.65f);
4264//                  x = x - (labelBounds.width * 0.5);
4265                        y = bounds.top + (int) (bounds.height() * 0.25f);
4266                        y = y + (int) (labelHeight * 0.5f);
4267                        //y = y + (labelHeight * 0.5);
4268
4269                        ti.setLocation(Math.round(x), Math.round(y));
4270                        arrMods.add(ti);
4271                    }
4272
4273                }
4274            }
4275            else if(ec == 211000)//Launched Torpedo
4276            {
4277                if (modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1)) {
4278                    strText = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
4279                    if (strText != null) {
4280                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4281                        labelWidth = Math.round(ti.getTextBounds().width());
4282                        x = (int)(bounds.left + (bounds.width() * 0.5) - (labelWidth/2));
4283                        y = bounds.top - bufferY;
4284
4285                        ti.setLocation(Math.round(x), Math.round(y));
4286                        arrMods.add(ti);
4287                    }
4288
4289                }
4290            }
4291            else if(ec == 214900 || ec == 215600)//General Sea SubSurface Station & General Sea Surface Station
4292            {
4293                if (modifiers.containsKey(Modifiers.W_DTG_1)) {
4294                    strText = modifiers.get(Modifiers.W_DTG_1);
4295                    if (strText != null) {
4296                        ti = new TextInfo(strText + " - ", 0, 0, modifierFont, modifierFontName);
4297                        x = bounds.left + (bounds.width() + bufferXR);
4298                        y = bounds.top + labelHeight;
4299
4300                        ti.setLocation(Math.round(x), Math.round(y));
4301                        arrMods.add(ti);
4302                    }
4303
4304                }
4305                if (modifiers.containsKey(Modifiers.W1_DTG_2)) {
4306                    strText = modifiers.get(Modifiers.W1_DTG_2);
4307                    if (strText != null) {
4308                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4309                        x = bounds.left + (bounds.width() + bufferXR);
4310                        y = bounds.top + (labelHeight * 2);
4311
4312                        ti.setLocation(Math.round(x), Math.round(y));
4313                        arrMods.add(ti);
4314                    }
4315
4316                }
4317                if (modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)) {
4318                    strText = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
4319                    if (strText != null) {
4320                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4321                        x = bounds.left + (bounds.width() + bufferXR);
4322                        y = bounds.top + (labelHeight * 3);
4323
4324                        ti.setLocation(Math.round(x), Math.round(y));
4325                        arrMods.add(ti);
4326                    }
4327
4328                }
4329            }
4330            else if(ec == 217000)//Shore Control Station
4331            {
4332                if (modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1)) {
4333                    strText = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
4334                    if (strText != null) {
4335                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4336                        labelWidth = Math.round(ti.getTextBounds().width());
4337                        x = (int)(bounds.left + (bounds.width() * 0.5) - (labelWidth/2));
4338                        y = bounds.top + bounds.height() + labelHeight + bufferY;
4339
4340                        ti.setLocation(Math.round(x), Math.round(y));
4341                        arrMods.add(ti);
4342                    }
4343
4344                }
4345            }
4346            else if(ec == 250600)//Known Point
4347            {
4348                if (modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)) {
4349                    strText = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
4350                    if (strText != null) {
4351                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4352                        labelWidth = Math.round(ti.getTextBounds().width());
4353                        x = bounds.left + (bounds.width() + bufferXR);
4354
4355                        if(!RendererSettings.getInstance().getOutlineSPControlMeasures() &&
4356                                !(attributes.containsKey(MilStdAttributes.OutlineSymbol) && Boolean.parseBoolean(attributes.get(MilStdAttributes.OutlineSymbol))))
4357                            x += bufferXR;
4358
4359                        y = bounds.top + (int) (bounds.height() * 0.30f);
4360
4361                        ti.setLocation(Math.round(x), Math.round(y));
4362                        arrMods.add(ti);
4363                    }
4364
4365                }
4366            }
4367            else if(ec == 360100 || ec == 360200 || ec == 360300)//Protection of Cultural Property
4368            {
4369                if (modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1)) {
4370                    strText = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
4371                    if (strText != null) {
4372                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4373
4374                        //One modifier symbols and modifier goes right of center
4375                        x = (int)(bounds.left + bounds.width() + bufferXR);
4376                        y = (int)(bounds.top + (bounds.height() * 0.6));
4377
4378                        ti.setLocation(Math.round(x), Math.round(y));
4379                        arrMods.add(ti);
4380                    }
4381                }
4382            }
4383        }
4384        else if(ss == SymbolID.SymbolSet_Atmospheric)
4385        {
4386            String modX = null;
4387            if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
4388                modX = (modifiers.get(Modifiers.X_ALTITUDE_DEPTH));
4389
4390            if(ec == 162300)//Freezing Level
4391            {
4392                strText = "0" + (char)(176) + ":";
4393                if(modX != null)
4394                    strText += modX;
4395                else
4396                    strText += "?";
4397
4398                ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4399                labelWidth = Math.round(ti.getTextBounds().width());
4400                //One modifier symbols and modifier goes in center
4401                x = bounds.left + (int) (bounds.width() * 0.5f);
4402                x = x - (int) (labelWidth * 0.5f);
4403                y = bounds.top + (int) (bounds.height() * 0.5f);
4404                y = y + (int) ((labelHeight - modifierFontDescent) * 0.5f);
4405
4406                ti.setLocation(Math.round(x), Math.round(y));
4407                arrMods.add(ti);
4408            }
4409            else if(ec == 162200)//tropopause Level
4410            {
4411                strText = "X?";
4412                if(modX != null)
4413                    strText = modX;
4414
4415                ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4416                labelWidth = Math.round(ti.getTextBounds().width());
4417                //One modifier symbols and modifier goes in center
4418                x = bounds.left + (int) (bounds.width() * 0.5f);
4419                x = x - (int) (labelWidth * 0.5f);
4420                y = bounds.top + (int) (bounds.height() * 0.5f);
4421                y = y + (int) ((labelHeight - modifierFontDescent) * 0.5f);
4422
4423                ti.setLocation(Math.round(x), Math.round(y));
4424                arrMods.add(ti);
4425            }
4426            else if(ec == 110102)//tropopause Low
4427            {
4428                strText = "X?";
4429                if(modX != null)
4430                    strText = modX;
4431
4432                ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4433                labelWidth = Math.round(ti.getTextBounds().width());
4434                //One modifier symbols and modifier goes in center
4435                x = bounds.left + (int) (bounds.width() * 0.5f);
4436                x = x - (int) (labelWidth * 0.5f);
4437                y = bounds.top + (int) (bounds.height() * 0.5f);
4438                y = y - descent;
4439
4440                ti.setLocation(Math.round(x), Math.round(y));
4441                arrMods.add(ti);
4442            }
4443            else if(ec == 110202)//tropopause High
4444            {
4445                strText = "X?";
4446                if(modX != null)
4447                    strText = modX;
4448
4449                ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4450                labelWidth = Math.round(ti.getTextBounds().width());
4451                //One modifier symbols and modifier goes in center
4452                x = bounds.left + (int) (bounds.width() * 0.5f);
4453                x = x - (int) (labelWidth * 0.5f);
4454                y = bounds.top + (int) (bounds.height() * 0.5f);
4455                //y = y + (int) ((labelHeight * 0.5f) + (labelHeight/2));
4456                y = y + (int) (((labelHeight * 0.5f) - (labelHeight/2)) + labelHeight - descent);
4457
4458                ti.setLocation(Math.round(x), Math.round(y));
4459                arrMods.add(ti);
4460            }
4461        }
4462        // </editor-fold>
4463
4464        // <editor-fold defaultstate="collapsed" desc="DOM Arrow">
4465        Point[] domPoints = null;
4466        Rect domBounds = null;
4467
4468        if (modifiers.containsKey(Modifiers.Q_DIRECTION_OF_MOVEMENT) &&
4469                SymbolUtilities.isCBRNEvent(symbolID))//CBRN events
4470        {
4471            strText = modifiers.get(Modifiers.Q_DIRECTION_OF_MOVEMENT);
4472            if(strText != null && SymbolUtilities.isNumber(strText))
4473            {
4474                    float q = Float.parseFloat(strText);
4475                    Rect tempBounds = new Rect(bounds);
4476                    tempBounds.union(RectUtilities.getCenterX(bounds), yForY);
4477        
4478                    domPoints = createDOMArrowPoints(symbolID, tempBounds, sdi.getCenterPoint(), q, false, modifierFontHeight);
4479        
4480                    domBounds = RectUtilities.makeRect(domPoints[0].x, domPoints[0].y, 1, 1);
4481        
4482                    Point temp = null;
4483                    for (int i = 1; i < 6; i++)
4484                    {
4485                        temp = domPoints[i];
4486                        if (temp != null)
4487                        {
4488                            domBounds.union(temp.x, temp.y);
4489                        }
4490                    }
4491                    imageBounds.union(domBounds);
4492            }
4493        }
4494        // </editor-fold>
4495
4496        // <editor-fold defaultstate="collapsed" desc="Build Feint Dummy Indicator">
4497        if (SymbolUtilities.hasFDI(symbolID))
4498        {
4499            //create feint indicator /\
4500            fdiLeft = new Point((int) symbolBounds.left, (int) symbolBounds.top);
4501            fdiRight = new Point((int) (symbolBounds.left + symbolBounds.width()), (int) symbolBounds.top);
4502            fdiTop = new Point(Math.round(RectUtilities.getCenterX(symbolBounds)), Math.round(symbolBounds.top - (symbolBounds.width() * .5f)));
4503
4504
4505            fdiBounds = RectUtilities.makeRect(fdiLeft.x, fdiLeft.y, 1, 1);
4506            fdiBounds.union(fdiTop.x, fdiTop.y);
4507            fdiBounds.union(fdiRight.x, fdiRight.y);
4508
4509            float fdiStrokeWidth = Math.round(RendererSettings.getInstance().getDeviceDPI() / 96f);
4510            RectUtilities.grow(fdiBounds,Math.round(fdiStrokeWidth/2));
4511
4512            ti = new TextInfo("TEST",0,0, modifierFont, modifierFontName);
4513            if (ti != null && SymbolUtilities.isCBRNEvent(symbolID))
4514            {
4515                int shiftY = Math.round(symbolBounds.top - ti.getTextBounds().height() - 2);
4516                fdiLeft.offset(0, shiftY);
4517                fdiTop.offset(0, shiftY);
4518                fdiRight.offset(0, shiftY);
4519                fdiBounds.offset(0, shiftY);
4520            }
4521
4522            imageBounds.union(fdiBounds);
4523
4524        }
4525        // </editor-fold>
4526
4527        // <editor-fold defaultstate="collapsed" desc="Shift Points and Draw">
4528        Rect modifierBounds = null;
4529        if (arrMods != null && arrMods.size() > 0)
4530        {
4531
4532            //build modifier bounds/////////////////////////////////////////
4533            modifierBounds = arrMods.get(0).getTextOutlineBounds();
4534            int size = arrMods.size();
4535            TextInfo tempShape = null;
4536            for (int i = 1; i < size; i++)
4537            {
4538                tempShape = arrMods.get(i);
4539                modifierBounds.union(tempShape.getTextOutlineBounds());
4540            }
4541
4542        }
4543
4544        if (modifierBounds != null || domBounds != null || fdiBounds != null)
4545        {
4546
4547            if (modifierBounds != null)
4548            {
4549                imageBounds.union(modifierBounds);
4550            }
4551            if (domBounds != null)
4552            {
4553                imageBounds.union(domBounds);
4554            }
4555            if (fdiBounds != null)
4556            {
4557                imageBounds.union(fdiBounds);
4558            }
4559
4560            //shift points if needed////////////////////////////////////////
4561            if (sdi instanceof ImageInfo && (imageBounds.left < 0 || imageBounds.top < 0))
4562            {
4563                int shiftX = Math.abs(imageBounds.left);
4564                int shiftY = Math.abs(imageBounds.top);
4565
4566                //shift mobility points
4567                int size = arrMods.size();
4568                TextInfo tempShape = null;
4569                for (int i = 0; i < size; i++)
4570                {
4571                    tempShape = arrMods.get(i);
4572                    tempShape.shift(shiftX, shiftY);
4573                }
4574                if(modifierBounds != null)
4575                    modifierBounds.offset(shiftX, shiftY);
4576
4577                if (domBounds != null)
4578                {
4579                    for (int i = 0; i < 6; i++)
4580                    {
4581                        Point temp = domPoints[i];
4582                        if (temp != null)
4583                        {
4584                            temp.offset(shiftX, shiftY);
4585                        }
4586                    }
4587                    domBounds.offset(shiftX, shiftY);
4588                }
4589
4590                //If there's an FDI
4591                if (fdiBounds != null)
4592                {
4593                    fdiBounds.offset(shiftX, shiftY);
4594                    fdiLeft.offset(shiftX, shiftY);
4595                    fdiTop.offset(shiftX, shiftY);
4596                    fdiRight.offset(shiftX, shiftY);
4597                }
4598
4599                //shift image points
4600                centerPoint.offset(shiftX, shiftY);
4601                symbolBounds.offset(shiftX, shiftY);
4602                imageBounds.offset(shiftX, shiftY);
4603            }
4604
4605
4606            if (attributes.containsKey(MilStdAttributes.TextColor))
4607            {
4608                textColor = RendererUtilities.getColorFromHexString(attributes.get(MilStdAttributes.TextColor));
4609                if(alpha > -1)
4610                    textColor.setAlpha(alpha);
4611            }
4612            if (attributes.containsKey(MilStdAttributes.TextBackgroundColor))
4613            {
4614                textBackgroundColor = RendererUtilities.getColorFromHexString(attributes.get(MilStdAttributes.TextBackgroundColor));
4615                if(alpha > -1)
4616                    textBackgroundColor.setAlpha(alpha);
4617            }
4618
4619            if(sdi instanceof ImageInfo) {
4620                ii = (ImageInfo)sdi;
4621                //Render modifiers//////////////////////////////////////////////////
4622                Bitmap bmp = Bitmap.createBitmap(imageBounds.width(), imageBounds.height(), Config.ARGB_8888);
4623                Canvas ctx = new Canvas(bmp);
4624
4625                //render////////////////////////////////////////////////////////
4626                //draw original icon with potential modifiers.
4627                ctx.drawBitmap(ii.getImage(), symbolBounds.left, symbolBounds.top, null);
4628                //ctx.drawImage(ii.getImage(),imageBoundsOld.left,imageBoundsOld.top);
4629
4630
4631                renderText(ctx, arrMods, textColor, textBackgroundColor, modifierFont);
4632
4633                //draw DOM arrow
4634                if (domBounds != null)
4635                {
4636                    drawDOMArrow(ctx, domPoints, alpha, lineColor);
4637                }
4638
4639                //<editor-fold defaultstate="collapsed" desc="Draw FDI">
4640                if (fdiBounds != null) {
4641
4642                    Paint fdiPaint = new Paint();
4643                    fdiPaint.setAntiAlias(true);
4644                    fdiPaint.setColor(lineColor.toInt());/// setARGB(255, 0, 0, 0);
4645                    if (alpha > -1)
4646                        fdiPaint.setAlpha(alpha);
4647                    fdiPaint.setStyle(Style.STROKE);
4648
4649                    int dpi = RendererSettings.getInstance().getDeviceDPI();
4650                    int lineLength = dpi / 96 * 6;
4651                    int lineGap = dpi / 96 * 4;
4652
4653                    /// ///////////////////////////////////
4654                    //Divide line in 14 parts. line is 3 parts to 2 parts gap
4655                    float distance = RendererUtilities.getDistanceBetweenPoints(fdiTop,fdiLeft);
4656                    //distance = distance / 14f;
4657                    lineGap = (int)((distance / 14f) * 2);
4658                    lineLength = (int)((distance / 14f) * 3);
4659                    /// //////////////////////////////////
4660
4661                    fdiPaint.setPathEffect(new DashPathEffect(new float[]
4662                            {
4663                                    lineLength, lineGap
4664                            }, 0));
4665
4666                    float fdiStrokeWidth = Math.round(dpi / 96f);
4667                    if (fdiStrokeWidth < 2)
4668                        fdiStrokeWidth = 2;
4669
4670                    fdiPaint.setStrokeCap(Cap.ROUND);
4671                    fdiPaint.setStrokeJoin(Join.MITER);
4672                    fdiPaint.setStrokeWidth(fdiStrokeWidth);
4673
4674                    Path fdiPath = new Path();
4675
4676                    fdiPath.moveTo(fdiTop.x, fdiTop.y);
4677                    fdiPath.lineTo(fdiLeft.x, fdiLeft.y);
4678                    fdiPath.moveTo(fdiTop.x, fdiTop.y);
4679                    fdiPath.lineTo(fdiRight.x, fdiRight.y);
4680                    ctx.drawPath(fdiPath, fdiPaint);
4681
4682                    fdiBounds = null;
4683
4684                }
4685                //</editor-fold>
4686
4687                newsdi = new ImageInfo(bmp, centerPoint, symbolBounds);
4688                ctx = null;
4689            }
4690            else if(sdi instanceof SVGSymbolInfo)
4691            {
4692                float strokeWidth = Math.round(RendererSettings.getInstance().getDeviceDPI() / 96f);
4693                if(strokeWidth < 1)
4694                    strokeWidth=1;
4695                String svgStroke = RendererUtilities.colorToHexString(lineColor,false);
4696                String svgStrokeWidth = String.valueOf(strokeWidth);//"3";
4697
4698                ssi = (SVGSymbolInfo)sdi;
4699                StringBuilder sbSVG = new StringBuilder();
4700                sbSVG.append(ssi.getSVG());
4701                sbSVG.append(renderTextElements(arrMods,textColor,textBackgroundColor));
4702
4703                // <editor-fold defaultstate="collapsed" desc="DOM arrow">
4704                if (domBounds != null && domPoints.length == 6)
4705                {
4706                    SVGPath domPath = new SVGPath() ;
4707
4708                    domPath.moveTo(domPoints[0].x, domPoints[0].y);
4709                    if (domPoints[1] != null)
4710                    {
4711                        domPath.lineTo(domPoints[1].x, domPoints[1].y);
4712                    }
4713                    if (domPoints[2] != null)
4714                    {
4715                        domPath.lineTo(domPoints[2].x, domPoints[2].y);
4716                    }
4717                    sbSVG.append(domPath.toSVGElement(svgStroke,Float.parseFloat(svgStrokeWidth),null,1f,1f,null));
4718
4719                    domPath = new SVGPath();
4720
4721                    domPath.moveTo(domPoints[3].x, domPoints[3].y);
4722                    domPath.lineTo(domPoints[4].x, domPoints[4].y);
4723                    domPath.lineTo(domPoints[5].x, domPoints[5].y);
4724                    sbSVG.append(domPath.toSVGElement(null,0f,svgStroke,1f,1f,null));
4725
4726                    domBounds = null;
4727                    domPoints = null;
4728                }
4729                // </editor-fold>
4730
4731                //<editor-fold defaultstate="collapsed" desc="Draw FDI">
4732                if (fdiBounds != null)
4733                {
4734
4735                    /*int dpi = RendererSettings.getInstance().getDeviceDPI();
4736                    int lineLength = dpi / 96 * 6;
4737                    int lineGap = dpi / 96 * 4;
4738                    String svgFDIDashArray = "" + lineLength + " " + lineGap;//*/
4739
4740                    /// ///////////////////////////////////
4741                    //Divide line in 14 parts. line is 3 parts to 2 parts gap
4742                    float distance = RendererUtilities.getDistanceBetweenPoints(fdiTop,fdiLeft);
4743                    //distance = distance / 14f;
4744                    int lineGap = (int)((distance / 14f) * 2);
4745                    int lineLength = (int)((distance / 14f) * 3);
4746                    String svgFDIDashArray = "" + lineLength + " " + lineGap;
4747                    /// //////////////////////////////////
4748
4749                    SVGPath fdiPath = new SVGPath();
4750                    fdiPath.moveTo(fdiTop.x, fdiTop.y);
4751                    fdiPath.lineTo(fdiLeft.x, fdiLeft.y);
4752                    fdiPath.moveTo(fdiTop.x, fdiTop.y);
4753                    fdiPath.lineTo(fdiRight.x, fdiRight.y);//*/
4754
4755                    fdiPath.setLineDash(svgFDIDashArray);
4756
4757                    sbSVG.append(fdiPath.toSVGElement(svgStroke,Float.parseFloat(svgStrokeWidth),null,1f,1f,"round"));
4758                    //sbSVG.append(Shape2SVG.Convert(fdiPath, svgStroke, null, svgStrokeWidth, svgAlpha, svgAlpha, svgFDIDashArray));
4759                }
4760                //</editor-fold>
4761
4762                newsdi = new SVGSymbolInfo(sbSVG.toString(),centerPoint,symbolBounds,imageBounds);
4763            }
4764
4765
4766
4767
4768            // <editor-fold defaultstate="collapsed" desc="Cleanup">
4769            //ctx = null;
4770            // </editor-fold>
4771
4772            return newsdi;
4773
4774        }
4775        else
4776        {
4777            return null;
4778        }
4779        // </editor-fold>
4780
4781    }
4782
4783    /**
4784     * Process modifiers for action points
4785     */
4786    public static SymbolDimensionInfo ProcessTGSPModifiers(SymbolDimensionInfo sdi, String symbolID, Map<String,String> modifiers, Map<String,String> attributes, Color lineColor)
4787    {
4788
4789        Paint modifierFont = getFont(attributes);
4790        float[] hd = getFontHeightandDescent(modifierFont);
4791        float modifierFontHeight = hd[0];
4792        float modifierFontDescent = hd[1];
4793
4794        String modifierFontName = RendererSettings.getInstance().getModiferFontProps()[0];
4795        if(attributes != null && attributes.containsKey(MilStdAttributes.FontFamily))
4796        {
4797            String temp = attributes.get(MilStdAttributes.FontFamily);
4798            if(temp != null && !temp.isEmpty())
4799                modifierFontName = temp;
4800        }
4801
4802        // <editor-fold defaultstate="collapsed" desc="Variables">
4803        ImageInfo ii = null;
4804        SVGSymbolInfo ssi = null;
4805
4806        int bufferXL = 6;
4807        int bufferXR = 4;
4808        int bufferY = 2;
4809        int bufferText = 2;
4810        int centerOffset = 1; //getCenterX/Y function seems to go over by a pixel
4811        int x = 0;
4812        int y = 0;
4813        int x2 = 0;
4814        int y2 = 0;
4815
4816        //Feint Dummy Indicator variables
4817        Rect fdiBounds = null;
4818        Point fdiTop = null;
4819        Point fdiLeft = null;
4820        Point fdiRight = null;
4821
4822        int outlineOffset = RS.getTextOutlineWidth();
4823        int labelHeight = 0;
4824        int labelWidth = 0;
4825        int alpha = -1;
4826        SymbolDimensionInfo newsdi = null;
4827        
4828        Color textColor = lineColor;
4829        Color textBackgroundColor = null;
4830
4831        ArrayList<TextInfo> arrMods = new ArrayList<TextInfo>();
4832        boolean duplicate = false;
4833
4834        MSInfo msi = MSLookup.getInstance().getMSLInfo(symbolID);
4835
4836
4837        if (attributes.containsKey(MilStdAttributes.Alpha))
4838        {
4839            alpha = Integer.parseInt(attributes.get(MilStdAttributes.Alpha));
4840        }
4841
4842        Rect bounds = new Rect(sdi.getSymbolBounds());
4843        Rect symbolBounds = new Rect(sdi.getSymbolBounds());
4844        Point centerPoint = new Point(sdi.getCenterPoint());
4845        Rect imageBounds = new Rect(sdi.getImageBounds());
4846
4847        centerPoint = new Point(Math.round(sdi.getCenterPoint().x), Math.round(sdi.getCenterPoint().y));
4848
4849        boolean byLabelHeight = false;
4850
4851        labelHeight = Math.round(modifierFontHeight + 0.5f);
4852        int maxHeight = (symbolBounds.height());
4853        if ((labelHeight * 3) > maxHeight)
4854        {
4855            byLabelHeight = true;
4856        }
4857
4858        int descent = (int) (modifierFontDescent + 0.5f);
4859        int yForY = -1;
4860
4861        Rect labelBounds1 = null;//text.getPixelBounds(null, 0, 0);
4862        Rect labelBounds2 = null;
4863        String strText = "";
4864        String strText1 = "";
4865        String strText2 = "";
4866        TextInfo text1 = null;
4867        TextInfo text2 = null;
4868
4869        String basicID = SymbolUtilities.getBasicSymbolID(symbolID);
4870
4871        if (outlineOffset > 2)
4872        {
4873            outlineOffset = ((outlineOffset - 1) / 2);
4874        }
4875        else
4876        {
4877            outlineOffset = 0;
4878        }
4879
4880        /*bufferXL += outlineOffset;
4881         bufferXR += outlineOffset;
4882         bufferY += outlineOffset;
4883         bufferText += outlineOffset;*/
4884        // </editor-fold>
4885        // <editor-fold defaultstate="collapsed" desc="Process Modifiers">
4886        TextInfo ti = null;
4887
4888        {
4889            if (msi.getModifiers().contains(Modifiers.N_HOSTILE) && modifiers.containsKey(Modifiers.N_HOSTILE))
4890            {
4891                strText = modifiers.get(Modifiers.N_HOSTILE);
4892                if(strText != null)
4893                {
4894                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4895        
4896                        x = bounds.left + bounds.width() + bufferXR;
4897        
4898                        if (!byLabelHeight)
4899                        {
4900                            y = ((bounds.height() / 3) * 2);//checkpoint, get box above the point
4901                            y = bounds.top + y;
4902                        }
4903                        else
4904                        {
4905                            //y = ((labelHeight + bufferText) * 3);
4906                            //y = bounds.y + y - descent;
4907                            y = bounds.top + bounds.height();
4908                        }
4909        
4910                        ti.setLocation(x, y);
4911                        arrMods.add(ti);
4912                }
4913
4914            }
4915            if (msi.getModifiers().contains(Modifiers.H_ADDITIONAL_INFO_1) && modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
4916            {
4917                strText = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
4918                if(strText != null)
4919                {
4920                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4921                        labelWidth = Math.round(ti.getTextBounds().width());
4922        
4923                        x = bounds.left + (int) (bounds.width() * 0.5f);
4924                        x = x - (int) (labelWidth * 0.5f);
4925                        y = bounds.top - descent;
4926        
4927                        ti.setLocation(x, y);
4928                        arrMods.add(ti);
4929                }
4930            }
4931            if (msi.getModifiers().contains(Modifiers.H1_ADDITIONAL_INFO_2) && modifiers.containsKey(Modifiers.H1_ADDITIONAL_INFO_2))
4932            {
4933                strText = modifiers.get(Modifiers.H1_ADDITIONAL_INFO_2);
4934                if(strText != null)
4935                {
4936                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4937                        labelWidth = Math.round(ti.getTextBounds().width());
4938        
4939                        x = bounds.left + (int) (bounds.width() * 0.5);
4940                        x = x - (int) (labelWidth * 0.5);
4941                    y = bounds.top + labelHeight - descent + (int) (bounds.height() * 0.07);
4942        
4943                        ti.setLocation(x, y);
4944                        arrMods.add(ti);
4945                }
4946            }
4947            if (msi.getModifiers().contains(Modifiers.A_SYMBOL_ICON))
4948            {
4949                if(modifiers.containsKey(Modifiers.A_SYMBOL_ICON))
4950                    strText = modifiers.get(Modifiers.A_SYMBOL_ICON);
4951                else if(SymbolID.getEntityCode(symbolID)==321706)//NATO Multiple Supply Class Point
4952                    strText = "ALL?";//make it clear the required 'A' value wasn't set for this symbol.
4953
4954                if(strText != null)
4955                {
4956                    ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4957                    labelWidth = Math.round(ti.getTextBounds().width());
4958
4959                    x = bounds.left + (int) (bounds.width() * 0.5);
4960                    x = x - (int) (labelWidth * 0.5);
4961                    y = bounds.top + labelHeight - descent + (int) (bounds.height() * 0.07);
4962
4963                    ti.setLocation(x, y);
4964                    arrMods.add(ti);
4965                }
4966            }
4967            if (msi.getModifiers().contains(Modifiers.W_DTG_1) && modifiers.containsKey(Modifiers.W_DTG_1))
4968            {
4969                strText = modifiers.get(Modifiers.W_DTG_1);
4970                if(strText != null)
4971                {
4972                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4973                        labelWidth = Math.round(ti.getTextBounds().width());
4974        
4975                        x = bounds.left - labelWidth - bufferXL;
4976                        y = bounds.top + labelHeight - descent;
4977        
4978                        ti.setLocation(x, y);
4979                        arrMods.add(ti);
4980                }
4981            }
4982            if (msi.getModifiers().contains(Modifiers.W1_DTG_2) && modifiers.containsKey(Modifiers.W1_DTG_2))
4983            {
4984                strText = modifiers.get(Modifiers.W1_DTG_2);
4985                if(strText != null)
4986                {
4987                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
4988                        labelWidth = Math.round(ti.getTextBounds().width());
4989        
4990                        x = bounds.left - labelWidth - bufferXL;
4991        
4992                        y = ((labelHeight - descent + bufferText) * 2);
4993                        y = bounds.top + y;
4994        
4995                        ti.setLocation(x, y);
4996                        arrMods.add(ti);
4997                }
4998            }
4999            if (msi.getModifiers().contains(Modifiers.T_UNIQUE_DESIGNATION_1) && modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
5000            {
5001                strText = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
5002                if(strText != null)
5003                {
5004                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
5005        
5006                        x = bounds.left + bounds.width() + bufferXR;
5007                        y = bounds.top + labelHeight - descent;
5008        
5009                        ti.setLocation(x, y);
5010                        arrMods.add(ti);
5011                }
5012            }
5013            if (msi.getModifiers().contains(Modifiers.T1_UNIQUE_DESIGNATION_2) && modifiers.containsKey(Modifiers.T1_UNIQUE_DESIGNATION_2))
5014            {
5015                strText = modifiers.get(Modifiers.T1_UNIQUE_DESIGNATION_2);
5016                if(strText != null)
5017                {
5018                        ti = new TextInfo(strText, 0, 0, modifierFont, modifierFontName);
5019                        labelWidth = Math.round(ti.getTextBounds().width());
5020        
5021                        //points
5022                        x = bounds.left + (int) (bounds.width() * 0.5);
5023                        x = x - (int) (labelWidth * 0.5);
5024                        //y = bounds.y + (bounds.height * 0.5);
5025        
5026                        y = (int) ((bounds.height() * 0.55));//633333333
5027                        y = bounds.top + y;
5028
5029                    int ec = SymbolID.getEntityCode(symbolID);
5030                    if((ec >= 281800 && ec <= 281809) || ec == 321100)
5031                    {
5032                        y = (int) ((bounds.height() * 0.63));
5033                        y = (int)bounds.top + y;
5034                    }
5035        
5036                        ti.setLocation(x, y);
5037                        arrMods.add(ti);
5038                }
5039            }
5040            // <editor-fold defaultstate="collapsed" desc="Build Feint Dummy Indicator">
5041            if (SymbolUtilities.hasFDI(symbolID))
5042            {
5043                //create feint indicator /\
5044                fdiLeft = new Point((int) symbolBounds.left, (int) symbolBounds.top);
5045                fdiRight = new Point((int) (symbolBounds.left + symbolBounds.width()), (int) symbolBounds.top);
5046                fdiTop = new Point(Math.round(RectUtilities.getCenterX(symbolBounds)), Math.round(symbolBounds.top - (symbolBounds.width() * .5f)));
5047
5048
5049                fdiBounds = RectUtilities.makeRect(fdiLeft.x, fdiLeft.y, 1, 1);
5050                fdiBounds.union(fdiTop.x, fdiTop.y);
5051                fdiBounds.union(fdiRight.x, fdiRight.y);
5052
5053                float fdiStrokeWidth = Math.round(RendererSettings.getInstance().getDeviceDPI() / 96f);
5054                RectUtilities.grow(fdiBounds,Math.round(fdiStrokeWidth/2));
5055
5056                ti = new TextInfo("TEST",0,0, modifierFont, modifierFontName);
5057                if (ti != null)
5058                {
5059                    int shiftY = Math.round(symbolBounds.top - ti.getTextBounds().height() - 2);
5060                    fdiLeft.offset(0, shiftY);
5061                    fdiTop.offset(0, shiftY);
5062                    fdiRight.offset(0, shiftY);
5063                    fdiBounds.offset(0, shiftY);
5064                }
5065
5066                imageBounds.union(fdiBounds);
5067
5068            }
5069            // </editor-fold>
5070        }
5071
5072        // </editor-fold>
5073        // <editor-fold defaultstate="collapsed" desc="Shift Points and Draw">
5074        Rect modifierBounds = null;
5075        if (arrMods != null && arrMods.size() > 0)
5076        {
5077
5078            //build modifier bounds/////////////////////////////////////////
5079            modifierBounds = arrMods.get(0).getTextOutlineBounds();
5080            int size = arrMods.size();
5081            TextInfo tempShape = null;
5082            for (int i = 1; i < size; i++)
5083            {
5084                tempShape = arrMods.get(i);
5085                modifierBounds.union(tempShape.getTextOutlineBounds());
5086            }
5087
5088        }
5089
5090        if(fdiBounds != null)
5091        {
5092            if(modifierBounds != null)
5093                modifierBounds.union(fdiBounds);
5094            else
5095                modifierBounds = fdiBounds;
5096        }
5097
5098        if (modifierBounds != null)
5099        {
5100
5101            imageBounds.union(modifierBounds);
5102
5103            //shift points if needed////////////////////////////////////////
5104            if (sdi instanceof ImageInfo && (imageBounds.left < 0 || imageBounds.top < 0))
5105            {
5106                int shiftX = Math.abs(imageBounds.left);
5107                int shiftY = Math.abs(imageBounds.top);
5108
5109                //shift mobility points
5110                int size = arrMods.size();
5111                TextInfo tempShape = null;
5112                for (int i = 0; i < size; i++)
5113                {
5114                    tempShape = arrMods.get(i);
5115                    tempShape.shift(shiftX, shiftY);
5116                }
5117                modifierBounds.offset(shiftX, shiftY);
5118
5119                //shift image points
5120                centerPoint.offset(shiftX, shiftY);
5121                symbolBounds.offset(shiftX, shiftY);
5122                imageBounds.offset(shiftX, shiftY);
5123
5124                //If there's an FDI
5125                if (fdiBounds != null)
5126                {
5127                    fdiBounds.offset(shiftX, shiftY);
5128                    fdiLeft.offset(shiftX, shiftY);
5129                    fdiTop.offset(shiftX, shiftY);
5130                    fdiRight.offset(shiftX, shiftY);
5131                }
5132            }
5133
5134            if (attributes.containsKey(MilStdAttributes.TextColor))
5135            {
5136                textColor = RendererUtilities.getColorFromHexString(attributes.get(MilStdAttributes.TextColor));
5137                if(alpha > -1)
5138                    textColor.setAlpha(alpha);
5139            }
5140            if (attributes.containsKey(MilStdAttributes.TextBackgroundColor))
5141            {
5142                textBackgroundColor = RendererUtilities.getColorFromHexString(attributes.get(MilStdAttributes.TextBackgroundColor));
5143                if(alpha > -1)
5144                    textBackgroundColor.setAlpha(alpha);
5145            }
5146
5147            if(sdi instanceof ImageInfo)
5148            {
5149                ii = (ImageInfo) sdi;
5150                //Render modifiers//////////////////////////////////////////////////
5151                Bitmap bmp = Bitmap.createBitmap(imageBounds.width(), imageBounds.height(), Config.ARGB_8888);
5152                Canvas ctx = new Canvas(bmp);
5153
5154                //draw original icon with potential modifiers.
5155                ctx.drawBitmap(ii.getImage(), symbolBounds.left, symbolBounds.top, null);
5156                //ctx.drawImage(ii.getImage(),imageBoundsOld.left,imageBoundsOld.top);
5157
5158
5159                renderText(ctx, arrMods, textColor, textBackgroundColor, modifierFont);
5160
5161                //<editor-fold defaultstate="collapsed" desc="Draw FDI">
5162                if (fdiBounds != null) {
5163
5164                    Paint fdiPaint = new Paint();
5165                    fdiPaint.setAntiAlias(true);
5166                    fdiPaint.setColor(lineColor.toInt());/// setARGB(255, 0, 0, 0);
5167                    if (alpha > -1)
5168                        fdiPaint.setAlpha(alpha);
5169                    fdiPaint.setStyle(Style.STROKE);
5170
5171                    int dpi = RendererSettings.getInstance().getDeviceDPI();
5172                    int lineLength = dpi / 96 * 6;
5173                    int lineGap = dpi / 96 * 4;
5174
5175                    /// ///////////////////////////////////
5176                    //Divide line in 14 parts. line is 3 parts to 2 parts gap
5177                    float distance = RendererUtilities.getDistanceBetweenPoints(fdiTop,fdiLeft);
5178                    //distance = distance / 14f;
5179                    lineGap = (int)((distance / 14f) * 2);
5180                    lineLength = (int)((distance / 14f) * 3);
5181                    /// //////////////////////////////////
5182
5183                    fdiPaint.setPathEffect(new DashPathEffect(new float[]
5184                            {
5185                                    lineLength, lineGap
5186                            }, 0));
5187
5188                    float fdiStrokeWidth = Math.round(dpi / 96f);
5189                    if (fdiStrokeWidth < 2)
5190                        fdiStrokeWidth = 2;
5191
5192                    fdiPaint.setStrokeCap(Cap.ROUND);
5193                    fdiPaint.setStrokeJoin(Join.MITER);
5194                    fdiPaint.setStrokeWidth(fdiStrokeWidth);
5195
5196                    Path fdiPath = new Path();
5197
5198                    fdiPath.moveTo(fdiTop.x, fdiTop.y);
5199                    fdiPath.lineTo(fdiLeft.x, fdiLeft.y);
5200                    fdiPath.moveTo(fdiTop.x, fdiTop.y);
5201                    fdiPath.lineTo(fdiRight.x, fdiRight.y);
5202                    ctx.drawPath(fdiPath, fdiPaint);
5203
5204                    fdiBounds = null;
5205
5206                }
5207                //</editor-fold>
5208
5209                newsdi = new ImageInfo(bmp, centerPoint, symbolBounds);
5210            }
5211            else if(sdi instanceof SVGSymbolInfo)
5212            {
5213                String svgStroke = RendererUtilities.colorToHexString(lineColor,false);
5214                String svgStrokeWidth = "3";
5215                String svgAlpha = null;
5216                if(alpha > -1)
5217                    svgAlpha = String.valueOf(alpha);
5218                ssi = (SVGSymbolInfo)sdi;
5219                StringBuilder sbSVG = new StringBuilder();
5220                sbSVG.append(ssi.getSVG());
5221                sbSVG.append(renderTextElements(arrMods,textColor,textBackgroundColor));
5222
5223                //<editor-fold defaultstate="collapsed" desc="Draw FDI">
5224                if (fdiBounds != null)
5225                {
5226                    /*int dpi = RendererSettings.getInstance().getDeviceDPI();
5227                    int lineLength = dpi / 96 * 6;
5228                    int lineGap = dpi / 96 * 4;
5229                    String svgFDIDashArray = "" + lineLength + " " + lineGap;//*/
5230
5231                    /// ///////////////////////////////////
5232                    //Divide line in 14 parts. line is 3 parts to 2 parts gap
5233                    float distance = RendererUtilities.getDistanceBetweenPoints(fdiTop,fdiLeft);
5234                    //distance = distance / 14f;
5235                    int lineGap = (int)((distance / 14f) * 2);
5236                    int lineLength = (int)((distance / 14f) * 3);
5237                    String svgFDIDashArray = "" + lineLength + " " + lineGap;
5238                    /// //////////////////////////////////
5239
5240                    SVGPath fdiPath = new SVGPath();
5241                    fdiPath.moveTo(fdiTop.x, fdiTop.y);
5242                    fdiPath.lineTo(fdiLeft.x, fdiLeft.y);
5243                    fdiPath.moveTo(fdiTop.x, fdiTop.y);
5244                    fdiPath.lineTo(fdiRight.x, fdiRight.y);//*/
5245
5246                    fdiPath.setLineDash(svgFDIDashArray);
5247                    sbSVG.append(fdiPath.toSVGElement(svgStroke,Float.parseFloat(svgStrokeWidth),null,1f,1f,"round"));
5248                    //sbSVG.append(Shape2SVG.Convert(fdiPath, svgStroke, null, svgStrokeWidth, svgAlpha, svgAlpha, svgFDIDashArray));
5249                }
5250                //</editor-fold>
5251
5252                newsdi = new SVGSymbolInfo(sbSVG.toString(),centerPoint,symbolBounds,imageBounds);
5253            }
5254
5255            // <editor-fold defaultstate="collapsed" desc="Cleanup">
5256            //ctx = null;
5257
5258            // </editor-fold>
5259        }
5260        // </editor-fold>
5261        return newsdi;
5262
5263    }
5264
5265    private static SymbolDimensionInfo shiftUnitPointsAndDraw(ArrayList<TextInfo> tiArray, SymbolDimensionInfo sdi, Map<String,String> attributes, Paint modifierFont)
5266    {
5267
5268        ImageInfo ii = null;
5269        SVGSymbolInfo ssi = null;
5270        SymbolDimensionInfo newsdi = null;
5271
5272        int alpha = -1;
5273
5274
5275        if (attributes != null && attributes.containsKey(MilStdAttributes.Alpha))
5276        {
5277            alpha = Integer.parseInt(attributes.get(MilStdAttributes.Alpha));
5278        }
5279
5280        Color textColor = Color.BLACK;
5281        Color textBackgroundColor = null;
5282
5283        Rect symbolBounds = new Rect(sdi.getSymbolBounds());
5284        Point centerPoint = new Point(sdi.getCenterPoint());
5285        Rect imageBounds = new Rect(sdi.getImageBounds());
5286        Rect imageBoundsOld = new Rect(sdi.getImageBounds());
5287
5288        Rect modifierBounds = null;
5289        if (tiArray != null && tiArray.size() > 0)
5290        {
5291
5292            //build modifier bounds/////////////////////////////////////////
5293            modifierBounds = tiArray.get(0).getTextOutlineBounds();
5294            int size = tiArray.size();
5295            TextInfo tempShape = null;
5296            for (int i = 1; i < size; i++)
5297            {
5298                tempShape = tiArray.get(i);
5299                modifierBounds.union(tempShape.getTextOutlineBounds());
5300            }
5301
5302        }
5303
5304        if (modifierBounds != null)
5305        {
5306
5307            imageBounds.union(modifierBounds);
5308
5309            //shift points if needed////////////////////////////////////////
5310            if (sdi instanceof ImageInfo && (imageBounds.left < 0 || imageBounds.top < 0))
5311            {
5312                int shiftX = Math.round(Math.abs(imageBounds.left)),
5313                        shiftY = Math.round(Math.abs(imageBounds.top));
5314
5315                //shift mobility points
5316                int size = tiArray.size();
5317                TextInfo tempShape = null;
5318                for (int i = 0; i < size; i++)
5319                {
5320                    tempShape = tiArray.get(i);
5321                    tempShape.shift(shiftX, shiftY);
5322                }
5323                RectUtilities.shift(modifierBounds, shiftX, shiftY);
5324                //modifierBounds.shift(shiftX,shiftY);
5325
5326                //shift image points
5327                centerPoint.offset(shiftX, shiftY);
5328                RectUtilities.shift(symbolBounds, shiftX, shiftY);
5329                RectUtilities.shift(imageBounds, shiftX, shiftY);
5330                RectUtilities.shift(imageBoundsOld, shiftX, shiftY);
5331                /*centerPoint.shift(shiftX, shiftY);
5332                 symbolBounds.shift(shiftX, shiftY);
5333                 imageBounds.shift(shiftX, shiftY);
5334                 imageBoundsOld.shift(shiftX, shiftY);//*/
5335            }
5336
5337            if (attributes != null && attributes.containsKey(MilStdAttributes.TextColor))
5338            {
5339                textColor = RendererUtilities.getColorFromHexString(attributes.get(MilStdAttributes.TextColor));
5340                if(alpha > -1)
5341                    textColor.setAlpha(alpha);
5342            }
5343            if (attributes != null && attributes.containsKey(MilStdAttributes.TextBackgroundColor))
5344            {
5345                textBackgroundColor = RendererUtilities.getColorFromHexString(attributes.get(MilStdAttributes.TextBackgroundColor));
5346                if(alpha > -1)
5347                    textBackgroundColor.setAlpha(alpha);
5348            }
5349
5350            if(sdi instanceof ImageInfo)
5351            {
5352                ii = (ImageInfo) sdi;
5353
5354                Bitmap bmp = Bitmap.createBitmap(imageBounds.width(), imageBounds.height(), Config.ARGB_8888);
5355                Canvas ctx = new Canvas(bmp);
5356
5357                //render////////////////////////////////////////////////////////
5358                //draw original icon with potential modifiers.
5359                ctx.drawBitmap(ii.getImage(), imageBoundsOld.left, imageBoundsOld.top, null);
5360                //ctx.drawImage(ii.getImage(),imageBoundsOld.left,imageBoundsOld.top);
5361
5362                renderText(ctx, tiArray, textColor, textBackgroundColor, modifierFont);
5363
5364                newsdi = new ImageInfo(bmp, centerPoint, symbolBounds);
5365            }
5366            else if(sdi instanceof SVGSymbolInfo)
5367            {
5368                ssi = (SVGSymbolInfo)sdi;
5369                StringBuilder sb = new StringBuilder();
5370                sb.append(ssi.getSVG());
5371                sb.append(renderTextElements(tiArray,textColor,textBackgroundColor));
5372                newsdi = new SVGSymbolInfo(sb.toString(),centerPoint,symbolBounds,imageBounds);
5373            }
5374        }
5375
5376        if(newsdi == null)
5377            newsdi = sdi;
5378
5379        return newsdi;
5380    }
5381    private static String renderTextElement(ArrayList<TextInfo> tiArray, Color color, Color backgroundColor)
5382    {
5383        StringBuilder sbSVG = new StringBuilder();
5384
5385        String svgStroke = RendererUtilities.colorToHexString(RendererUtilities.getIdealOutlineColor(color),false);
5386        if(backgroundColor != null)
5387            svgStroke = RendererUtilities.colorToHexString(backgroundColor,false);
5388
5389        String svgFill = RendererUtilities.colorToHexString(color,false);
5390        String svgStrokeWidth = String.valueOf(RendererSettings.getInstance().getTextOutlineWidth());
5391        for (TextInfo ti : tiArray) {
5392            sbSVG.append(Shape2SVG.Convert(ti, svgStroke,svgFill,svgStrokeWidth,null,null,null));
5393            sbSVG.append("\n");
5394        }
5395
5396        return sbSVG.toString();
5397    }
5398
5399    private static String renderTextElements(ArrayList<TextInfo> tiArray, Color color, Color backgroundColor)
5400    {
5401        String style = null;
5402        String name = tiArray.get(0).getFontName();//"SansSerif";
5403        if(!name.endsWith("serif"))
5404            name += ", sans-serif";
5405        String size = String.valueOf(tiArray.get(0).getFontSize());
5406        String weight = null;
5407        String anchor = null;//"start";
5408        if(tiArray.get(0).getFontStyle() == Typeface.BOLD)
5409            weight = "bold";
5410        StringBuilder sbSVG = new StringBuilder();
5411
5412        String svgStroke = RendererUtilities.colorToHexString(RendererUtilities.getIdealOutlineColor(color),false);
5413        if(backgroundColor != null)
5414            svgStroke = RendererUtilities.colorToHexString(backgroundColor,false);
5415
5416        String svgFill = RendererUtilities.colorToHexString(color,false);
5417        String svgStrokeWidth = String.valueOf(RendererSettings.getInstance().getTextOutlineWidth());
5418        sbSVG.append("\n<g");
5419        sbSVG.append(" font-family=\"").append(name).append('"');
5420        sbSVG.append(" font-size=\"").append(size).append("px\"");
5421        if(weight != null)
5422            sbSVG.append(" font-weight=\"").append(weight).append("\"");
5423        sbSVG.append(" alignment-baseline=\"alphabetic\"");//
5424        sbSVG.append(">");
5425
5426        for (TextInfo ti : tiArray) {
5427            sbSVG.append(Shape2SVG.ConvertForGroup(ti, svgStroke,svgFill,svgStrokeWidth,null,null,null));
5428            sbSVG.append("\n");
5429        }
5430        sbSVG.append("</g>\n");
5431
5432        return sbSVG.toString();
5433    }
5434    private static void renderText(Canvas ctx, ArrayList<TextInfo> tiArray, Color color, Color backgroundColor, Paint font)
5435    {
5436        ModifierRenderer.renderText(ctx, (TextInfo[]) tiArray.toArray(new TextInfo[0]), color, backgroundColor, font);
5437    }
5438
5439    /**
5440     * 
5441     * @param ctx
5442     * @param tiArray
5443     * @param color
5444     * @param backgroundColor 
5445     */
5446    public static void renderText(Canvas ctx, TextInfo[] tiArray, Color color, Color backgroundColor, Paint modifierFont)
5447    {
5448        /*for (TextInfo textInfo : tiArray) 
5449         {
5450         ctx.drawText(textInfo.getText(), textInfo.getLocation().x, textInfo.getLocation().y, modifierFont);    
5451         }*/
5452
5453        int size = tiArray.length;
5454
5455        int tbm = RS.getTextBackgroundMethod();
5456        int outlineWidth = RS.getTextOutlineWidth();
5457
5458        if (color == null)
5459        {
5460            color = Color.BLACK;
5461        }
5462
5463        Color outlineColor = null;
5464        
5465        if(backgroundColor != null)
5466            outlineColor = backgroundColor;
5467        else
5468            outlineColor = RendererUtilities.getIdealOutlineColor(color);
5469
5470        if (tbm == RendererSettings.TextBackgroundMethod_OUTLINE_QUICK)
5471        {
5472            synchronized (modifierFontMutex) {
5473                //draw text outline
5474                modifierFont.setStyle(Style.FILL);
5475                modifierFont.setStrokeWidth(RS.getTextOutlineWidth());
5476                modifierFont.setColor(outlineColor.toInt());
5477
5478                if (outlineWidth > 2)
5479                    outlineWidth = 2;
5480
5481                if (outlineWidth > 0) {
5482                    for (int i = 0; i < size; i++) {
5483                        TextInfo textInfo = tiArray[i];
5484                        if (outlineWidth > 0) {
5485                            for (int j = 1; j <= outlineWidth; j++) {
5486                                if (j == 1) {
5487                                    ctx.drawText(textInfo.getText(), textInfo.getLocation().x - j, textInfo.getLocation().y - j, modifierFont);
5488                                    ctx.drawText(textInfo.getText(), textInfo.getLocation().x + j, textInfo.getLocation().y - j, modifierFont);
5489                                    ctx.drawText(textInfo.getText(), textInfo.getLocation().x - j, textInfo.getLocation().y + j, modifierFont);
5490                                    ctx.drawText(textInfo.getText(), textInfo.getLocation().x + j, textInfo.getLocation().y + j, modifierFont);
5491
5492                                    ctx.drawText(textInfo.getText(), textInfo.getLocation().x - j, textInfo.getLocation().y, modifierFont);
5493                                    ctx.drawText(textInfo.getText(), textInfo.getLocation().x + j, textInfo.getLocation().y, modifierFont);
5494
5495                                } else {
5496                                    ctx.drawText(textInfo.getText(), textInfo.getLocation().x - j, textInfo.getLocation().y - j, modifierFont);
5497                                    ctx.drawText(textInfo.getText(), textInfo.getLocation().x + j, textInfo.getLocation().y - j, modifierFont);
5498                                    ctx.drawText(textInfo.getText(), textInfo.getLocation().x - j, textInfo.getLocation().y + j, modifierFont);
5499                                    ctx.drawText(textInfo.getText(), textInfo.getLocation().x + j, textInfo.getLocation().y + j, modifierFont);
5500
5501                                    ctx.drawText(textInfo.getText(), textInfo.getLocation().x - j, textInfo.getLocation().y, modifierFont);
5502                                    ctx.drawText(textInfo.getText(), textInfo.getLocation().x + j, textInfo.getLocation().y, modifierFont);
5503
5504                                    ctx.drawText(textInfo.getText(), textInfo.getLocation().x, textInfo.getLocation().y + j, modifierFont);
5505                                    ctx.drawText(textInfo.getText(), textInfo.getLocation().x, textInfo.getLocation().y - j, modifierFont);
5506                                }
5507
5508                            }
5509
5510                        }
5511
5512                    }
5513                }
5514                //draw text
5515                modifierFont.setColor(color.toInt());
5516
5517                for (int j = 0; j < size; j++) {
5518                    TextInfo textInfo = tiArray[j];
5519                    ctx.drawText(textInfo.getText(), textInfo.getLocation().x, textInfo.getLocation().y, modifierFont);
5520                /*Paint outline = new Paint();
5521                 outline.setStyle(Style.STROKE);
5522                 outline.setColor(Color.red.toInt());
5523                 outline.setAlpha(155);
5524                 outline.setStrokeWidth(1f);
5525                 ctx.drawRect(textInfo.getTextBounds(), outline);
5526                 outline.setColor(Color.blue.toInt());
5527                 ctx.drawRect(textInfo.getTextOutlineBounds(), outline);//*/
5528                }
5529            }
5530        }
5531        else if (tbm == RendererSettings.TextBackgroundMethod_OUTLINE)
5532        {
5533            synchronized (modifierFontMutex) {
5534                //draw text outline
5535                //draw text outline
5536                modifierFont.setStyle(Style.STROKE);
5537                modifierFont.setStrokeWidth(RS.getTextOutlineWidth());
5538                modifierFont.setColor(outlineColor.toInt());
5539                if (outlineWidth > 0) {
5540                    for (int i = 0; i < size; i++) {
5541                        TextInfo textInfo = tiArray[i];
5542                        ctx.drawText(textInfo.getText(), textInfo.getLocation().x, textInfo.getLocation().y, modifierFont);
5543                    }
5544                }
5545                //draw text
5546                modifierFont.setColor(color.toInt());
5547                modifierFont.setStyle(Style.FILL);
5548                for (int j = 0; j < size; j++) {
5549                    TextInfo textInfo = tiArray[j];
5550                    ctx.drawText(textInfo.getText(), textInfo.getLocation().x, textInfo.getLocation().y, modifierFont);
5551                }
5552            }
5553        }
5554        else if (tbm == RendererSettings.TextBackgroundMethod_COLORFILL)
5555        {
5556            synchronized (modifierFontMutex) {
5557                Paint rectFill = new Paint();
5558                rectFill.setStyle(Paint.Style.FILL);
5559                rectFill.setColor(outlineColor.toARGB());
5560
5561
5562                //draw rectangle
5563                for (int k = 0; k < size; k++) {
5564                    TextInfo textInfo = tiArray[k];
5565                    ctx.drawRect(textInfo.getTextOutlineBounds(), rectFill);
5566                }
5567                //draw text
5568                modifierFont.setColor(color.toInt());
5569                modifierFont.setStyle(Style.FILL);
5570                for (int j = 0; j < size; j++) {
5571                    TextInfo textInfo = tiArray[j];
5572                    ctx.drawText(textInfo.getText(), textInfo.getLocation().x, textInfo.getLocation().y, modifierFont);
5573                }
5574            }
5575        }
5576        else if (tbm == RendererSettings.TextBackgroundMethod_NONE)
5577        {
5578            synchronized (modifierFontMutex) {
5579                modifierFont.setColor(color.toInt());
5580                modifierFont.setStyle(Style.FILL);
5581                for (int j = 0; j < size; j++) {
5582                    TextInfo textInfo = tiArray[j];
5583                    ctx.drawText(textInfo.getText(), textInfo.getLocation().x, textInfo.getLocation().y, modifierFont);
5584                }
5585            }
5586        }
5587    }
5588
5589    /**
5590     *
5591     * @param symbolID
5592     * @param modifiers
5593     * @return int[] where {xposition (-1 left, 0 centered, 1 right), yposition (0 centered, 1+ goes up, 1- goes down),
5594     * centered (0-no, 1-yes)} -999 means passed modifier is not supported by this symbol
5595     */
5596    private static List<Modifier> getLabelPositionIndexes(String symbolID, Map<String,String> modifiers, Map<String,String> attributes)
5597    {
5598        List<Modifier> mods = null;
5599        if(modifiers != null && !modifiers.isEmpty())
5600            mods = new ArrayList<>();
5601        else
5602            return null;
5603
5604        int ver = SymbolID.getVersion(symbolID);
5605        int ss = SymbolID.getSymbolSet(symbolID);
5606        int x = 0;
5607        int y = 0;
5608        boolean centered = true;
5609        int p = RendererSettings.getInstance().getSPModifierPlacement();
5610        boolean strict = (RendererSettings.getInstance().getSPModifierPlacement() == RendererSettings.ModifierPlacement_STRICT);
5611        if(attributes != null && attributes.containsKey(MilStdAttributes.ModifierPlacement))
5612        {
5613            String mp = attributes.get(MilStdAttributes.ModifierPlacement);
5614            if(mp.equals("0") || mp.equals("1") || mp.equals("2"))
5615            {
5616                p = Integer.parseInt(mp);
5617                if(p == 0)
5618                    strict = true;
5619                else
5620                    strict = false;
5621            }
5622        }
5623        String temp = null;
5624        String sep = " ";
5625
5626
5627        if(ver == SymbolID.Version_2525Dch1)
5628        {
5629            if(ss == SymbolID.SymbolSet_LandUnit ||
5630                    ss == SymbolID.SymbolSet_LandCivilianUnit_Organization)
5631            {
5632
5633                //Only Command & Control has AA; ec.equals("110000").  Always in the middle of the unit.
5634                if(modifiers.containsKey(Modifiers.AA_SPECIAL_C2_HQ))
5635                {
5636                    temp = modifiers.get(Modifiers.AA_SPECIAL_C2_HQ);
5637                    if(temp != null && !temp.isEmpty())
5638                        mods.add(new Modifier("AA", temp, 0, 0, true));
5639                }
5640
5641                //Do top center label
5642                x = 0;//centered
5643                y = 9;//on top of symbol
5644                if(modifiers.containsKey(Modifiers.B_ECHELON))
5645                {
5646                    temp = modifiers.get(Modifiers.B_ECHELON);
5647                    if(temp != null && !temp.isEmpty())
5648                        mods.add(new Modifier("B", temp, x, y, centered));
5649                }
5650
5651                //Do right side labels
5652                x = 1;//on right
5653                if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
5654                {
5655                    y = 0;//center
5656                    centered = true;//vertically centered, only matters for labels on left and right side
5657                    temp = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
5658                    if(temp != null && !temp.isEmpty())
5659                        mods.add(new Modifier("H", temp, x, y, centered));
5660                }
5661                else if(!strict)
5662                {
5663                    //if no "H', bring G and M closer to the center
5664                    centered = false;
5665                }
5666
5667                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
5668                {
5669                    y = 1;//above center
5670                    temp = modifiers.get(Modifiers.G_STAFF_COMMENTS);
5671                    if(temp != null && !temp.isEmpty())
5672                        mods.add(new Modifier("G", temp, x, y, centered));
5673                }
5674
5675                if(modifiers.containsKey(Modifiers.F_REINFORCED_REDUCED) || modifiers.containsKey(Modifiers.AS_COUNTRY))
5676                {
5677                    y = 2;
5678                    if(!strict && !modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
5679                        y--;
5680                    temp = "";
5681                    if(modifiers.containsKey(Modifiers.F_REINFORCED_REDUCED))
5682                        temp = modifiers.get(Modifiers.F_REINFORCED_REDUCED) + sep;
5683                    if(modifiers.containsKey(Modifiers.AS_COUNTRY))
5684                        temp += modifiers.get(Modifiers.AS_COUNTRY);
5685                    temp = temp.trim();
5686                    if(temp != null && !temp.isEmpty())
5687                        mods.add(new Modifier("F AS", temp, x, y, centered));
5688                }
5689
5690                if(modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
5691                {
5692                    y = -1;//below center
5693                    temp = modifiers.get(Modifiers.M_HIGHER_FORMATION);
5694                    if(temp != null && !temp.isEmpty())
5695                        mods.add(new Modifier("M", temp, x, y, centered));
5696                }
5697
5698                if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING) ||
5699                        modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS) ||
5700                        modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
5701                {
5702                    y = -2;
5703                    if(!strict && !modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
5704                        y++;
5705                    temp = "";
5706                    if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING))
5707                        temp = modifiers.get(Modifiers.J_EVALUATION_RATING) + sep;
5708                    if(modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS))
5709                        temp += modifiers.get(Modifiers.K_COMBAT_EFFECTIVENESS) + sep;
5710                    if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
5711                        temp += modifiers.get(Modifiers.P_IFF_SIF_AIS);
5712                    temp = temp.trim();
5713                    if(temp != null && !temp.isEmpty())
5714                        mods.add(new Modifier("J K P", temp, x, y, centered));
5715                }
5716
5717                //Do left side labels
5718                x = -1;//on left
5719                centered = false;
5720
5721                if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION))
5722                {
5723                    y = 1;
5724                    temp = "";
5725                    if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
5726                        temp = modifiers.get(Modifiers.X_ALTITUDE_DEPTH) + sep;
5727                    if(modifiers.containsKey(Modifiers.Y_LOCATION))
5728                        temp += modifiers.get(Modifiers.Y_LOCATION);
5729
5730                    temp = temp.trim();
5731                    if(temp != null && !temp.isEmpty())
5732                        mods.add(new Modifier("X Y", temp, x, y, centered));
5733                }
5734
5735                if(modifiers.containsKey(Modifiers.W_DTG_1))
5736                {
5737                    y = 2;//above center
5738                    if(!strict && !(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION)))
5739                        y--;
5740                    temp = modifiers.get(Modifiers.W_DTG_1);
5741                    if(temp != null && !temp.isEmpty())
5742                        mods.add(new Modifier("W", temp, x, y, centered));
5743                }
5744
5745                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
5746                {
5747                    y = -1;//below center
5748                    temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
5749                    if(temp != null && !temp.isEmpty())
5750                        mods.add(new Modifier("T", temp, x, y, centered));
5751                }
5752
5753                if(modifiers.containsKey(Modifiers.Z_SPEED))
5754                {
5755                    y = -2;
5756                    if(!strict && !modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
5757                        y++;
5758                    temp = modifiers.get(Modifiers.Z_SPEED);
5759                    if(temp != null && !temp.isEmpty())
5760                        mods.add(new Modifier(Modifiers.J_EVALUATION_RATING, temp, x, y, centered));
5761                }
5762            }
5763            else if(ss == SymbolID.SymbolSet_LandEquipment ||
5764                    ss == SymbolID.SymbolSet_SignalsIntelligence_Land)
5765            {
5766                //Do top center label
5767                x = 0;//centered
5768                y = 9;//on top of symbol
5769                if(modifiers.containsKey(Modifiers.C_QUANTITY))
5770                {
5771                    temp = modifiers.get(Modifiers.C_QUANTITY);
5772                    if(temp != null && !temp.isEmpty())
5773                        mods.add(new Modifier("C", temp, x, y, centered));
5774                }
5775
5776                //Do right side labels
5777                x = 1;//on right
5778                if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1) || modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
5779                {
5780                    y = 0;//center
5781                    centered = true;//vertically centered, only matters for labels on left and right side
5782                    temp = "";
5783                    if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
5784                        temp = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1) + sep;
5785                    if(modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
5786                        temp += modifiers.get(Modifiers.AF_COMMON_IDENTIFIER);
5787                    temp = temp.trim();
5788                    if(temp != null && !temp.isEmpty())
5789                        mods.add(new Modifier("H AF", temp, x, y, centered));
5790                }
5791                else if(!strict)
5792                {
5793                    //if no "H', bring G and M closer to the center
5794                    centered = false;
5795                }
5796
5797                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) || modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT))
5798                {
5799                    y = 1;//above center
5800                    temp = "";
5801                    if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
5802                        temp = modifiers.get(Modifiers.G_STAFF_COMMENTS) + sep;
5803                    if(modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT))
5804                        temp += modifiers.get(Modifiers.AQ_GUARDED_UNIT);
5805                    temp = temp.trim();
5806                    if(temp != null && !temp.isEmpty())
5807                        mods.add(new Modifier("G AQ", temp, x, y, centered));
5808                }
5809
5810                if(modifiers.containsKey(Modifiers.AS_COUNTRY))
5811                {
5812                    y = 2;
5813                    if(!strict && !(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) || modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT)))
5814                        y--;
5815
5816                    temp = modifiers.get(Modifiers.AS_COUNTRY);
5817                    if(temp != null && !temp.isEmpty())
5818                        mods.add(new Modifier("AS", temp, x, y, centered));
5819                }
5820
5821                if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING) ||
5822                        modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP) ||
5823                        modifiers.containsKey(Modifiers.N_HOSTILE) ||
5824                        modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
5825                {
5826                    y = -1;
5827
5828                    temp = "";
5829                    if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING))
5830                        temp = modifiers.get(Modifiers.J_EVALUATION_RATING) + sep;
5831                    if(modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP))
5832                        temp += modifiers.get(Modifiers.L_SIGNATURE_EQUIP) + sep;
5833                    if(modifiers.containsKey(Modifiers.N_HOSTILE))
5834                        temp += modifiers.get(Modifiers.N_HOSTILE) + sep;
5835                    if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
5836                        temp += modifiers.get(Modifiers.P_IFF_SIF_AIS);
5837                    temp = temp.trim();
5838                    if(temp != null && !temp.isEmpty())
5839                        mods.add(new Modifier("J L N P", temp, x, y, centered));
5840                }
5841
5842                //Do left side labels
5843                x = -1;//on left
5844
5845                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE) ||
5846                        modifiers.containsKey(Modifiers.AD_PLATFORM_TYPE) ||
5847                        modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME))
5848                {
5849                    y = 0;//center
5850                    centered = true;//vertically centered, only matters for labels on left and right side
5851
5852                    temp = "";
5853                    if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
5854                        temp = modifiers.get(Modifiers.V_EQUIP_TYPE) + sep;
5855                    if(modifiers.containsKey(Modifiers.AD_PLATFORM_TYPE))
5856                        temp += modifiers.get(Modifiers.AD_PLATFORM_TYPE) + sep;
5857                    if(modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME))
5858                        temp += modifiers.get(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME);
5859                    temp = temp.trim();
5860                    if(temp != null && !temp.isEmpty())
5861                        mods.add(new Modifier("V AD AE", temp, x, y, centered));
5862                }
5863                else if(!strict)
5864                {
5865                    centered = false;
5866                }
5867
5868                if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION))
5869                {
5870                    y = 1;
5871                    temp = "";
5872                    if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
5873                        temp = modifiers.get(Modifiers.X_ALTITUDE_DEPTH) + sep;
5874                    if(modifiers.containsKey(Modifiers.Y_LOCATION))
5875                        temp += modifiers.get(Modifiers.Y_LOCATION);
5876
5877                    temp = temp.trim();
5878                    mods.add(new Modifier("X Y", temp, x, y, centered));
5879                }
5880
5881                if(modifiers.containsKey(Modifiers.W_DTG_1) || modifiers.containsKey(Modifiers.AR_SPECIAL_DESIGNATOR))
5882                {
5883                    y = 2;//above center
5884                    if(!strict && !(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION)))
5885                        y--;
5886
5887                    temp = modifiers.get(Modifiers.W_DTG_1);
5888
5889                    if(temp != null && !temp.isEmpty())
5890                        mods.add(new Modifier("W", temp, x, y, centered));
5891                }
5892
5893                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
5894                {
5895                    y = -1;//below center
5896                    temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
5897                    if(temp != null && !temp.isEmpty())
5898                        mods.add(new Modifier("T", temp, x, y, centered));
5899                }
5900
5901                if(modifiers.containsKey(Modifiers.Z_SPEED))
5902                {
5903                    y = -2;
5904                    if(!strict && !modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
5905                        y++;
5906                    temp = modifiers.get(Modifiers.Z_SPEED);
5907                    if(temp != null && !temp.isEmpty())
5908                        mods.add(new Modifier("Z", temp, x, y, centered));
5909                }
5910            }
5911            else if(ss == SymbolID.SymbolSet_LandInstallation)
5912            {
5913                //No top center label
5914
5915                //Do right side labels
5916                x = 1;//on right
5917
5918                if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
5919                {
5920                    y = 0;//center
5921                    centered = true;//vertically centered, only matters for labels on left and right side
5922                    temp = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
5923
5924                    if(temp != null && !temp.isEmpty())
5925                        mods.add(new Modifier("H", temp, x, y, centered));
5926                }
5927                else if(!strict)
5928                {
5929                    centered = false;
5930                }
5931
5932                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
5933                {
5934                    y = 1;//above center
5935                    temp = modifiers.get(Modifiers.G_STAFF_COMMENTS);
5936
5937                    if(temp != null && !temp.isEmpty())
5938                        mods.add(new Modifier("G", temp, x, y, centered));
5939                }
5940
5941                if(modifiers.containsKey(Modifiers.AS_COUNTRY))
5942                {
5943                    y = 2;
5944                    if(!strict && !modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
5945                        y--;
5946
5947                    temp = modifiers.get(Modifiers.AS_COUNTRY);
5948                    if(temp != null && !temp.isEmpty())
5949                        mods.add(new Modifier("AS", temp, x, y, centered));
5950                }
5951
5952                if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING) ||
5953                        modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS) ||
5954                        modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
5955                {
5956                    y = -1;
5957
5958                    temp = "";
5959                    if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING))
5960                        temp = modifiers.get(Modifiers.J_EVALUATION_RATING) + sep;
5961                    if(modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS))
5962                        temp += modifiers.get(Modifiers.K_COMBAT_EFFECTIVENESS) + sep;
5963                    if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
5964                        temp += modifiers.get(Modifiers.P_IFF_SIF_AIS);
5965                    temp = temp.trim();
5966                    mods.add(new Modifier("J K P", temp, x, y, centered));
5967                }
5968
5969                //Do left side labels
5970                x = -1;//on left
5971
5972                if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION))
5973                {
5974                    y = 0;//center
5975                    centered = true;//vertically centered, only matters for labels on left and right side
5976
5977                    temp = "";
5978                    if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
5979                        temp = modifiers.get(Modifiers.X_ALTITUDE_DEPTH) + sep;
5980                    if(modifiers.containsKey(Modifiers.Y_LOCATION))
5981                        temp += modifiers.get(Modifiers.Y_LOCATION);
5982                    temp = temp.trim();
5983                    if(temp != null && !temp.isEmpty())
5984                        mods.add(new Modifier("X Y", temp, x, y, centered));
5985                }
5986                else if(!strict)
5987                {
5988                    centered = false;
5989                }
5990
5991                if(modifiers.containsKey(Modifiers.W_DTG_1))
5992                {
5993                    y = 1;//above center
5994
5995                    temp = modifiers.get(Modifiers.W_DTG_1);
5996
5997                    if(temp != null && !temp.isEmpty())
5998                        mods.add(new Modifier("W AR", temp, x, y, centered));
5999                }
6000
6001                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
6002                {
6003                    y = -1;//below center
6004                    temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
6005                    if(temp != null && !temp.isEmpty())
6006                        mods.add(new Modifier("T", temp, x, y, centered));
6007                }
6008            }
6009            else if(ss == SymbolID.SymbolSet_Air ||
6010                    ss == SymbolID.SymbolSet_AirMissile ||
6011                    ss == SymbolID.SymbolSet_SignalsIntelligence_Air)
6012            {
6013                //No top center label
6014
6015
6016                //Do right side labels
6017                x = 1;//on right
6018                centered = false;centered = true;
6019                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
6020                {
6021                    y = 0;//center
6022                    centered = true;//vertically centered, only matters for labels on left and right side
6023                    temp = modifiers.get(Modifiers.V_EQUIP_TYPE);
6024                    if(temp != null && !temp.isEmpty())
6025                        mods.add(new Modifier("V", temp, x, y, centered));
6026                }
6027                else if(!strict)
6028                {
6029                    //if no "H', bring G and M closer to the center
6030                    centered = false;
6031                }
6032
6033                if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
6034                {
6035                    y = 1;//above center
6036                    temp = modifiers.get(Modifiers.P_IFF_SIF_AIS);
6037
6038                    if(temp != null && !temp.isEmpty())
6039                        mods.add(new Modifier("P", temp, x, y, centered));
6040                }
6041
6042                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1) || modifiers.containsKey(Modifiers.AS_COUNTRY))
6043                {
6044                    y = 2;
6045                    if(!strict && !modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
6046                        y--;
6047                    temp = "";
6048                    if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
6049                        temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1) + sep;
6050                    if(modifiers.containsKey(Modifiers.AS_COUNTRY))
6051                        temp += modifiers.get(Modifiers.AS_COUNTRY);
6052                    temp = temp.trim();
6053
6054                    if(temp != null && !temp.isEmpty())
6055                        mods.add(new Modifier("T AS", temp, x, y, centered));
6056                }
6057
6058                if(modifiers.containsKey(Modifiers.Z_SPEED)  ||
6059                        modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
6060                {
6061                    y = -1;//below center
6062                    if(!modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
6063                        y++;
6064
6065                    temp = "";
6066                    if(modifiers.containsKey(Modifiers.Z_SPEED))
6067                        temp = modifiers.get(Modifiers.Z_SPEED) + sep;
6068                    if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
6069                        temp += modifiers.get(Modifiers.X_ALTITUDE_DEPTH);
6070                    temp = temp.trim();
6071
6072                    if(temp != null && !temp.isEmpty())
6073                        mods.add(new Modifier("Z X", temp, x, y, centered));
6074                }
6075
6076                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) ||
6077                        modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
6078                {
6079                    y = -2 ;
6080                    if(!strict)
6081                    {
6082                        if(!(modifiers.containsKey(Modifiers.Z_SPEED)  ||
6083                                modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH)))
6084                            y++;
6085                    }
6086                    temp = "";
6087                    if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
6088                        temp = modifiers.get(Modifiers.G_STAFF_COMMENTS) + sep;
6089                    if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
6090                        temp += modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
6091                    temp = temp.trim();
6092                    if(temp != null && !temp.isEmpty())
6093                        mods.add(new Modifier("G H", temp, x, y, centered));
6094                }
6095
6096                //No left side labels
6097
6098            }
6099            else if(ss == SymbolID.SymbolSet_Space ||
6100                    ss == SymbolID.SymbolSet_SpaceMissile ||
6101                    ss == SymbolID.SymbolSet_SignalsIntelligence_Space)
6102            {
6103                //No top center label
6104
6105
6106                //Do right side labels
6107                x = 1;//on right
6108                centered = false;
6109
6110                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
6111                {
6112                    y = 1;//above center
6113                    temp = modifiers.get(Modifiers.V_EQUIP_TYPE);
6114                    if(temp != null && !temp.isEmpty())
6115                        mods.add(new Modifier("V", temp, x, y, centered));
6116                }
6117
6118                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1) || modifiers.containsKey(Modifiers.AS_COUNTRY))
6119                {
6120                    y = 2;
6121                    if(!strict && !modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
6122                        y--;
6123                    temp = "";
6124                    if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
6125                        temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1) + sep;
6126                    if(modifiers.containsKey(Modifiers.AS_COUNTRY))
6127                        temp += modifiers.get(Modifiers.AS_COUNTRY);
6128                    temp = temp.trim();
6129
6130                    if(temp != null && !temp.isEmpty())
6131                        mods.add(new Modifier("T AS", temp, x, y, centered));
6132                }
6133
6134                if(modifiers.containsKey(Modifiers.Z_SPEED)  ||
6135                        modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
6136                {
6137                    y = -1;//below center
6138                    temp = "";
6139                    if(modifiers.containsKey(Modifiers.Z_SPEED))
6140                        temp = modifiers.get(Modifiers.Z_SPEED) + sep;
6141                    if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
6142                        temp += modifiers.get(Modifiers.X_ALTITUDE_DEPTH);
6143                    temp = temp.trim();
6144
6145                    if(temp != null && !temp.isEmpty())
6146                        mods.add(new Modifier("Z X", temp, x, y, centered));
6147                }
6148
6149                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) ||
6150                        modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
6151                {
6152                    y = -2;
6153                    if(!strict &&
6154                            !(modifiers.containsKey(Modifiers.Z_SPEED) || modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH)))
6155                        y++;
6156                    temp = "";
6157                    if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
6158                        temp = modifiers.get(Modifiers.G_STAFF_COMMENTS) + sep;
6159                    if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
6160                        temp += modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
6161                    temp = temp.trim();
6162                    if(temp != null && !temp.isEmpty())
6163                        mods.add(new Modifier("G H", temp, x, y, centered));
6164                }
6165
6166                //No left side labels
6167            }
6168            else if(ss == SymbolID.SymbolSet_SeaSurface ||
6169                    ss == SymbolID.SymbolSet_SignalsIntelligence_SeaSurface)
6170            {
6171                //No top center label
6172
6173
6174                //Do right side labels
6175                x = 1;//on right
6176                centered = true;
6177                if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
6178                {
6179                    y = 0;//center
6180                    centered = true;//vertically centered, only matters for labels on left and right side
6181                    temp = modifiers.get(Modifiers.P_IFF_SIF_AIS);
6182                    if(temp != null && !temp.isEmpty())
6183                        mods.add(new Modifier("P", temp, x, y, centered));
6184                }
6185                else if(!strict)
6186                {
6187                    //if no "H', bring G and M closer to the center
6188                    centered = false;
6189                }
6190
6191                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
6192                {
6193                    y = 1;//above center
6194                    temp = modifiers.get(Modifiers.V_EQUIP_TYPE);
6195                    if(temp != null && !temp.isEmpty())
6196                        mods.add(new Modifier("V", temp, x, y, centered));
6197                }
6198
6199                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1) || modifiers.containsKey(Modifiers.AS_COUNTRY))
6200                {
6201                    y = 2;
6202                    if(!strict && !modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
6203                        y--;
6204                    temp = "";
6205                    if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
6206                        temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1) + sep;
6207                    if(modifiers.containsKey(Modifiers.AS_COUNTRY))
6208                        temp += modifiers.get(Modifiers.AS_COUNTRY);
6209                    temp = temp.trim();
6210
6211                    if(temp != null && !temp.isEmpty())
6212                        mods.add(new Modifier("T AS", temp, x, y, centered));
6213                }
6214
6215                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS)  ||
6216                        modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
6217                {
6218                    y = -1;//below center
6219                    temp = "";
6220                    if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
6221                        temp = modifiers.get(Modifiers.G_STAFF_COMMENTS) + sep;
6222                    if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
6223                        temp += modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
6224                    temp = temp.trim();
6225
6226                    if(temp != null && !temp.isEmpty())
6227                        mods.add(new Modifier("G H", temp, x, y, centered));
6228                }
6229
6230                if(modifiers.containsKey(Modifiers.Y_LOCATION) ||
6231                        modifiers.containsKey(Modifiers.Z_SPEED))
6232                {
6233                    y = -2;
6234                    if(!strict &&
6235                            !(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) || modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1)))
6236                        y++;
6237                    temp = "";
6238                    if(modifiers.containsKey(Modifiers.Y_LOCATION))
6239                        temp = modifiers.get(Modifiers.Y_LOCATION) + sep;
6240                    if(modifiers.containsKey(Modifiers.Z_SPEED))
6241                        temp += modifiers.get(Modifiers.Z_SPEED);
6242                    temp = temp.trim();
6243                    if(temp != null && !temp.isEmpty())
6244                        mods.add(new Modifier("Y Z", temp, x, y, centered));
6245                }
6246
6247                //Do left side labels
6248                x = -1;
6249                centered = false;
6250                if(modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT) || modifiers.containsKey(Modifiers.AR_SPECIAL_DESIGNATOR))
6251                {
6252                    y = 2;//above center
6253                    if(!strict)
6254                        y--;
6255
6256                    temp = "";
6257                    if(modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT))
6258                        temp = modifiers.get(Modifiers.AQ_GUARDED_UNIT) + sep;
6259                    if(modifiers.containsKey(Modifiers.AR_SPECIAL_DESIGNATOR))
6260                        temp += modifiers.get(Modifiers.AR_SPECIAL_DESIGNATOR);
6261                    temp = temp.trim();
6262
6263                    if(temp != null && !temp.isEmpty())
6264                        mods.add(new Modifier("AQ AR", temp, x, y, centered));
6265                }
6266            }
6267            else if(ss == SymbolID.SymbolSet_SeaSubsurface ||
6268                    ss == SymbolID.SymbolSet_SignalsIntelligence_SeaSubsurface)
6269            {
6270                //No top center label
6271
6272
6273                //Do right side labels
6274                x = 1;//on right
6275                centered = true;
6276                if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
6277                {
6278                    y = 0;//center
6279                    centered = true;//vertically centered, only matters for labels on left and right side
6280                    temp = modifiers.get(Modifiers.X_ALTITUDE_DEPTH);
6281                    if(temp != null && !temp.isEmpty())
6282                        mods.add(new Modifier("X", temp, x, y, centered));
6283                }
6284                else if(!strict)
6285                {
6286                    //if no "H', bring G and M closer to the center
6287                    centered = false;
6288                }
6289
6290                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
6291                {
6292                    y = 1;//center
6293                    temp = modifiers.get(Modifiers.V_EQUIP_TYPE);
6294                    if(temp != null && !temp.isEmpty())
6295                        mods.add(new Modifier("V", temp, x, y, centered));
6296                }
6297
6298                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1) || modifiers.containsKey(Modifiers.AS_COUNTRY))
6299                {
6300                    y = 2;
6301                    if(!strict && !modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
6302                        y--;
6303                    temp = "";
6304                    if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
6305                        temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1) + sep;
6306                    if(modifiers.containsKey(Modifiers.AS_COUNTRY))
6307                        temp += modifiers.get(Modifiers.AS_COUNTRY);
6308                    temp = temp.trim();
6309
6310                    if(temp != null && !temp.isEmpty())
6311                        mods.add(new Modifier("T AS", temp, x, y, centered));
6312                }
6313
6314                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
6315                {
6316                    y = -1;
6317
6318                    temp = modifiers.get(Modifiers.G_STAFF_COMMENTS);
6319
6320                    if(temp != null && !temp.isEmpty())
6321                        mods.add(new Modifier("G", temp, x, y, centered));
6322                }
6323
6324                if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
6325                {
6326                    y = -2;//below center
6327                    if(!strict)
6328                    {
6329                        if(!modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
6330                            y++;
6331                    }
6332
6333                    temp = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
6334
6335                    if(temp != null && !temp.isEmpty())
6336                        mods.add(new Modifier("H", temp, x, y, centered));
6337                }
6338
6339                //Do left side labels
6340                x = -1;
6341                centered = false;
6342                if(modifiers.containsKey(Modifiers.AR_SPECIAL_DESIGNATOR))
6343                {
6344                    y = 3;//above center
6345                    if(!strict)
6346                    {
6347                        y--;
6348                    }
6349
6350                    temp = modifiers.get(Modifiers.AR_SPECIAL_DESIGNATOR);
6351
6352                    if(temp != null && !temp.isEmpty())
6353                        mods.add(new Modifier("AR", temp, x, y, centered));
6354                }
6355
6356            }
6357            else if(ss == SymbolID.SymbolSet_Activities)
6358            {
6359                //No top center label
6360
6361                //Do right side labels
6362                x = 1;//on right
6363                centered = false;
6364
6365                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
6366                {
6367                    y = 1;
6368
6369                    temp = modifiers.get(Modifiers.G_STAFF_COMMENTS);
6370                    if(temp != null && !temp.isEmpty())
6371                        mods.add(new Modifier("G", temp, x, y, centered));
6372                }
6373
6374                if(modifiers.containsKey(Modifiers.AS_COUNTRY))
6375                {
6376                    y = 2;
6377                    if(!strict && !modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
6378                        y--;
6379                    temp = modifiers.get(Modifiers.AS_COUNTRY);
6380
6381                    if(temp != null && !temp.isEmpty())
6382                        mods.add(new Modifier("AS", temp, x, y, centered));
6383                }
6384
6385                if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
6386                {
6387                    y = -1;//below center
6388                    temp = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
6389                    if(temp != null && !temp.isEmpty())
6390                        mods.add(new Modifier("H", temp, x, y, centered));
6391                }
6392
6393                if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING))
6394                {
6395                    y = -2;
6396                    if(!strict && !modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
6397                        y++;
6398                    temp = temp = modifiers.get(Modifiers.J_EVALUATION_RATING);
6399
6400                    if(temp != null && !temp.isEmpty())
6401                        mods.add(new Modifier("J", temp, x, y, centered));
6402                }
6403
6404                //Do left side labels
6405                x = -1;//on left
6406                centered = false;
6407
6408                if(modifiers.containsKey(Modifiers.Y_LOCATION))
6409                {
6410                    y = 1;
6411                    temp = modifiers.get(Modifiers.Y_LOCATION);
6412
6413                    if(temp != null && !temp.isEmpty())
6414                        mods.add(new Modifier("Y", temp, x, y, centered));
6415                }
6416
6417                if(modifiers.containsKey(Modifiers.W_DTG_1))
6418                {
6419                    y = 2;//above center
6420                    if(!strict && !modifiers.containsKey(Modifiers.Y_LOCATION))
6421                        y--;
6422                    temp = modifiers.get(Modifiers.W_DTG_1);
6423                    if(temp != null && !temp.isEmpty())
6424                        mods.add(new Modifier("W", temp, x, y, centered));
6425                }
6426
6427            }
6428            else if(ss == SymbolID.SymbolSet_CyberSpace)
6429            {
6430                //Do top center label
6431                x = 0;//centered
6432                y = 9;//on top of symbol
6433                if(modifiers.containsKey(Modifiers.B_ECHELON))
6434                {
6435                    temp = modifiers.get(Modifiers.B_ECHELON);
6436                    if(temp != null && !temp.isEmpty())
6437                        mods.add(new Modifier("B", temp, x, y, centered));
6438                }
6439
6440                //Do right side labels
6441                x = 1;//on right
6442                if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
6443                {
6444                    y = 0;//center
6445                    centered = true;//vertically centered, only matters for labels on left and right side
6446                    temp = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
6447                    if(temp != null && !temp.isEmpty())
6448                        mods.add(new Modifier("H", temp, x, y, centered));
6449                }
6450                else if(!strict)
6451                {
6452                    //if no "H', bring G and M closer to the center
6453                    centered = false;
6454                }
6455
6456                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
6457                {
6458                    y = 1;//above center
6459                    temp = modifiers.get(Modifiers.G_STAFF_COMMENTS);
6460                    if(temp != null && !temp.isEmpty())
6461                        mods.add(new Modifier("G", temp, x, y, centered));
6462                }
6463
6464                if(modifiers.containsKey(Modifiers.F_REINFORCED_REDUCED) || modifiers.containsKey(Modifiers.AS_COUNTRY))
6465                {
6466                    y = 2;
6467                    if(!strict && !modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
6468                        y--;
6469                    temp = "";
6470                    if(modifiers.containsKey(Modifiers.F_REINFORCED_REDUCED))
6471                        temp = modifiers.get(Modifiers.F_REINFORCED_REDUCED) + sep;
6472                    if(modifiers.containsKey(Modifiers.AS_COUNTRY))
6473                        temp += modifiers.get(Modifiers.AS_COUNTRY);
6474                    temp = temp.trim();
6475                    if(temp != null && !temp.isEmpty())
6476                        mods.add(new Modifier("F AS", temp, x, y, centered));
6477                }
6478
6479                if(modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
6480                {
6481                    y = -1;//below center
6482                    temp = modifiers.get(Modifiers.M_HIGHER_FORMATION);
6483                    if(temp != null && !temp.isEmpty())
6484                        mods.add(new Modifier("M", temp, x, y, centered));
6485                }
6486
6487                if(modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS) ||
6488                        modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP))
6489                {
6490                    y = -2;
6491                    if(!strict && !modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
6492                        y++;
6493                    temp = "";
6494                    if(modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS))
6495                        temp = modifiers.get(Modifiers.K_COMBAT_EFFECTIVENESS) + sep;
6496                    if(modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP))
6497                        temp += modifiers.get(Modifiers.L_SIGNATURE_EQUIP);
6498
6499                    temp = temp.trim();
6500                    if(temp != null && !temp.isEmpty())
6501                        mods.add(new Modifier("K L", temp, x, y, centered));
6502                }
6503
6504                //Do left side labels
6505                x = -1;//on left
6506                centered = true;
6507
6508                if(modifiers.containsKey(Modifiers.Y_LOCATION))
6509                {
6510                    y = 0;
6511                    temp = modifiers.get(Modifiers.Y_LOCATION);
6512
6513                    if(temp != null && !temp.isEmpty())
6514                        mods.add(new Modifier("Y", temp, x, y, centered));
6515                }
6516                else if (!strict)
6517                {
6518                    centered = false;
6519                }
6520
6521                if(modifiers.containsKey(Modifiers.W_DTG_1))
6522                {
6523                    y = 1;//above center
6524                    temp = modifiers.get(Modifiers.W_DTG_1);
6525                    if(temp != null && !temp.isEmpty())
6526                        mods.add(new Modifier("W", temp, x, y, centered));
6527                }
6528
6529                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1) || modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
6530                {
6531                    y = -1;//below center
6532                    temp = "";
6533                    if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
6534                        temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1) + sep;
6535                    if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
6536                        temp += modifiers.get(Modifiers.V_EQUIP_TYPE);
6537
6538                    temp = temp.trim();
6539                    if(temp != null && !temp.isEmpty())
6540                        mods.add(new Modifier("T V", temp, x, y, centered));
6541                }
6542
6543            }
6544            /*else if(ver == SymbolID.SymbolSet_MineWarfare)
6545            {
6546                //no modifiers
6547            }//*/
6548            //else//SymbolSet Unknown
6549            //processUnknownTextModifiers
6550        }
6551        else if(ver == SymbolID.Version_2525E || ver == SymbolID.Version_2525Ech1)
6552        {
6553            int fs = SymbolID.getFrameShape(symbolID);
6554            if(ss == SymbolID.SymbolSet_LandUnit ||
6555                    ss == SymbolID.SymbolSet_LandCivilianUnit_Organization ||
6556                    (ss == SymbolID.SymbolSet_SignalsIntelligence && fs == SymbolID.FrameShape_LandUnit))
6557            {
6558
6559                //Only Command & Control has AA; ec.equals("110000").  Always in the middle of the unit.
6560                if(modifiers.containsKey(Modifiers.AA_SPECIAL_C2_HQ))
6561                {
6562                    temp = modifiers.get(Modifiers.AA_SPECIAL_C2_HQ);
6563                    if(temp != null && !temp.isEmpty())
6564                        mods.add(new Modifier("AA", temp, 0, 0, true));
6565                }
6566                
6567                //Do top center label
6568                x = 0;//centered
6569                y = 9;//on top of symbol
6570                if(modifiers.containsKey(Modifiers.B_ECHELON))
6571                {
6572                    temp = modifiers.get(Modifiers.B_ECHELON);
6573                    if(temp != null && !temp.isEmpty())
6574                        mods.add(new Modifier("B", temp, x, y, centered));
6575                }
6576
6577                //Do right side labels
6578                x = 1;//on right
6579                if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1) ||
6580                        modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
6581                {
6582                    y = 0;//center
6583                    centered = true;//vertically centered, only matters for labels on left and right side
6584                    temp = "";
6585                    if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
6586                        temp = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1) + sep;
6587                    if(modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
6588                        temp += modifiers.get(Modifiers.AF_COMMON_IDENTIFIER);
6589                    temp = temp.trim();
6590                    if(temp != null && !temp.isEmpty())
6591                        mods.add(new Modifier("H AF", temp, x, y, centered));
6592                }
6593                else if(!strict)
6594                {
6595                    //if no "H', bring G and M closer to the center
6596                    centered = false;
6597                }
6598
6599                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) || modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT))
6600                {
6601                    y = 1;//above center
6602                    temp = "";
6603                    if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
6604                        temp = modifiers.get(Modifiers.G_STAFF_COMMENTS) + sep;
6605                    if(modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT))
6606                        temp += modifiers.get(Modifiers.AQ_GUARDED_UNIT);
6607                    temp = temp.trim();
6608                    if(temp != null && !temp.isEmpty())
6609                        mods.add(new Modifier("G AQ", temp, x, y, centered));
6610                }
6611
6612                if(modifiers.containsKey(Modifiers.F_REINFORCED_REDUCED) || modifiers.containsKey(Modifiers.AS_COUNTRY))
6613                {
6614                    y = 2;
6615                    if(!strict && !(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) || modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT)))
6616                        y--;
6617                    temp = "";
6618                    if(modifiers.containsKey(Modifiers.F_REINFORCED_REDUCED))
6619                        temp = modifiers.get(Modifiers.F_REINFORCED_REDUCED) + sep;
6620                    if(modifiers.containsKey(Modifiers.AS_COUNTRY))
6621                        temp += modifiers.get(Modifiers.AS_COUNTRY);
6622                    temp = temp.trim();
6623                    if(temp != null && !temp.isEmpty())
6624                        mods.add(new Modifier("F AS", temp, x, y, centered));
6625                }
6626
6627                if(modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
6628                {
6629                    y = -1;//below center
6630                    temp = modifiers.get(Modifiers.M_HIGHER_FORMATION);
6631                    if(temp != null && !temp.isEmpty())
6632                        mods.add(new Modifier("M", temp, x, y, centered));
6633                }
6634
6635                if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING) ||
6636                        modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS) ||
6637                        modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP) ||
6638                        modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
6639                {
6640                    y = -2;
6641                    if(!strict && !modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
6642                        y++;
6643                    temp = "";
6644                    if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING))
6645                        temp = modifiers.get(Modifiers.J_EVALUATION_RATING) + sep;
6646                    if(modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS))
6647                        temp += modifiers.get(Modifiers.K_COMBAT_EFFECTIVENESS) + sep;
6648                    if(modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP))
6649                        temp += modifiers.get(Modifiers.L_SIGNATURE_EQUIP) + sep;
6650                    if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
6651                        temp += modifiers.get(Modifiers.P_IFF_SIF_AIS);
6652                    temp = temp.trim();
6653                    if(temp != null && !temp.isEmpty())
6654                        mods.add(new Modifier("J K L P", temp, x, y, centered));
6655                }
6656
6657                //Do left side labels
6658                x = -1;//on left
6659
6660                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE) ||
6661                        modifiers.containsKey(Modifiers.AD_PLATFORM_TYPE) ||
6662                        modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME))
6663                {
6664                    y = 0;//center
6665                    centered = true;//vertically centered, only matters for labels on left and right side
6666
6667                    temp = "";
6668                    if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
6669                        temp = modifiers.get(Modifiers.V_EQUIP_TYPE) + sep;
6670                    if(modifiers.containsKey(Modifiers.AD_PLATFORM_TYPE))
6671                        temp += modifiers.get(Modifiers.AD_PLATFORM_TYPE) + sep;
6672                    if(modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME))
6673                        temp += modifiers.get(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME);
6674                    temp = temp.trim();
6675                    if(temp != null && !temp.isEmpty())
6676                        mods.add(new Modifier("V AD AE", temp, x, y, centered));
6677                }
6678                else if(!strict)
6679                {
6680                    centered = false;
6681                }
6682
6683                if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION))
6684                {
6685                    y = 1;
6686                    temp = "";
6687                    if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
6688                        temp = modifiers.get(Modifiers.X_ALTITUDE_DEPTH) + sep;
6689                    if(modifiers.containsKey(Modifiers.Y_LOCATION))
6690                        temp += modifiers.get(Modifiers.Y_LOCATION);
6691
6692                    temp = temp.trim();
6693                    mods.add(new Modifier("X Y", temp, x, y, centered));
6694                }
6695
6696                if(modifiers.containsKey(Modifiers.W_DTG_1))
6697                {
6698                    y = 2;//above center
6699                    if(!strict && !(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION)))
6700                        y--;
6701
6702                    temp = modifiers.get(Modifiers.W_DTG_1);
6703
6704                    if(temp != null && !temp.isEmpty())
6705                        mods.add(new Modifier("W", temp, x, y, centered));
6706                }
6707
6708                if(modifiers.containsKey(Modifiers.C_QUANTITY) || modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
6709                {
6710                    y = -1;//below center
6711                    temp = "";
6712                    if(modifiers.containsKey(Modifiers.C_QUANTITY))
6713                        temp = modifiers.get(Modifiers.C_QUANTITY) + sep;
6714                    if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
6715                        temp += modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
6716
6717                    temp = temp.trim();
6718                    if(temp != null && !temp.isEmpty())
6719                        mods.add(new Modifier("C T", temp, x, y, centered));
6720                }
6721
6722                if(modifiers.containsKey(Modifiers.Z_SPEED))
6723                {
6724                    y = -2;
6725                    if(!strict && !(modifiers.containsKey(Modifiers.C_QUANTITY) || modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)))
6726                        y++;
6727                    temp = modifiers.get(Modifiers.Z_SPEED);
6728                    if(temp != null && !temp.isEmpty())
6729                        mods.add(new Modifier("Z", temp, x, y, centered));
6730                }
6731            }
6732            else if(ss == SymbolID.SymbolSet_LandEquipment ||
6733                    (ss == SymbolID.SymbolSet_SignalsIntelligence && fs == SymbolID.FrameShape_LandEquipment))
6734            {
6735                //Do top center label
6736                x = 0;//centered
6737                y = 9;//on top of symbol
6738                if(modifiers.containsKey(Modifiers.C_QUANTITY))
6739                {
6740                    temp = modifiers.get(Modifiers.C_QUANTITY);
6741                    if(temp != null && !temp.isEmpty())
6742                        mods.add(new Modifier("C", temp, x, y, centered));
6743                }
6744
6745                //Do right side labels
6746                x = 1;//on right
6747                centered = false;
6748
6749                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) || modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT))
6750                {
6751                    y = 1;//above center
6752                    temp = "";
6753                    if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
6754                        temp = modifiers.get(Modifiers.G_STAFF_COMMENTS) + sep;
6755                    if(modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT))
6756                        temp += modifiers.get(Modifiers.AQ_GUARDED_UNIT);
6757                    temp = temp.trim();
6758                    if(temp != null && !temp.isEmpty())
6759                        mods.add(new Modifier("G AQ", temp, x, y, centered));
6760                }
6761
6762                if( modifiers.containsKey(Modifiers.AS_COUNTRY))
6763                {
6764                    y = 2;
6765                    if(!strict && !(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) || modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT)))
6766                        y--;
6767                    temp = modifiers.get(Modifiers.AS_COUNTRY);
6768
6769                    if(temp != null && !temp.isEmpty())
6770                        mods.add(new Modifier("AS", temp, x, y, centered));
6771                }
6772
6773                if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1) ||
6774                        modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
6775                {
6776                    y = -1;
6777                    temp = "";
6778                    if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
6779                        temp = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1) + sep;
6780                    if(modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
6781                        temp += modifiers.get(Modifiers.AF_COMMON_IDENTIFIER);
6782                    temp = temp.trim();
6783                    if(temp != null && !temp.isEmpty())
6784                        mods.add(new Modifier("H AF", temp, x, y, centered));
6785                }
6786
6787                if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING) ||
6788                        modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS) ||
6789                        modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP) ||
6790                        modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
6791                {
6792                    y = -2;
6793                    if(!strict && !(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1) ||
6794                            modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER)))
6795                        y++;
6796                    temp = "";
6797                    if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING))
6798                        temp = modifiers.get(Modifiers.J_EVALUATION_RATING) + sep;
6799                    if(modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS))
6800                        temp += modifiers.get(Modifiers.K_COMBAT_EFFECTIVENESS) + sep;
6801                    if(modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP))
6802                        temp += modifiers.get(Modifiers.L_SIGNATURE_EQUIP) + sep;
6803                    if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
6804                        temp += modifiers.get(Modifiers.P_IFF_SIF_AIS);
6805                    temp = temp.trim();
6806                    if(temp != null && !temp.isEmpty())
6807                        mods.add(new Modifier("J K L P", temp, x, y, centered));
6808                }
6809
6810                //Do left side labels
6811                x = -1;//on left
6812
6813                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE) ||
6814                        modifiers.containsKey(Modifiers.AD_PLATFORM_TYPE) ||
6815                        modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME))
6816                {
6817                    y = 0;//center
6818                    centered = true;//vertically centered, only matters for labels on left and right side
6819
6820                    temp = "";
6821                    if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
6822                        temp = modifiers.get(Modifiers.V_EQUIP_TYPE) + sep;
6823                    if(modifiers.containsKey(Modifiers.AD_PLATFORM_TYPE))
6824                        temp += modifiers.get(Modifiers.AD_PLATFORM_TYPE) + sep;
6825                    if(modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME))
6826                        temp += modifiers.get(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME);
6827                    temp = temp.trim();
6828                    if(temp != null && !temp.isEmpty())
6829                        mods.add(new Modifier("V AD AE", temp, x, y, centered));
6830                }
6831                else if(!strict)
6832                {
6833                    centered = false;
6834                }
6835
6836                if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION))
6837                {
6838                    y = 1;
6839                    temp = "";
6840                    if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
6841                        temp = modifiers.get(Modifiers.X_ALTITUDE_DEPTH) + sep;
6842                    if(modifiers.containsKey(Modifiers.Y_LOCATION))
6843                        temp += modifiers.get(Modifiers.Y_LOCATION);
6844
6845                    temp = temp.trim();
6846                    mods.add(new Modifier("X Y", temp, x, y, centered));
6847                }
6848
6849                if(modifiers.containsKey(Modifiers.W_DTG_1))
6850                {
6851                    y = 2;//above center
6852                    if(!strict && !(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION)))
6853                        y--;
6854
6855                    temp = modifiers.get(Modifiers.W_DTG_1);
6856
6857                    if(temp != null && !temp.isEmpty())
6858                        mods.add(new Modifier("W", temp, x, y, centered));
6859                }
6860
6861                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
6862                {
6863                    y = -1;//below center
6864                    temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
6865
6866                    temp = temp.trim();
6867                    if(temp != null && !temp.isEmpty())
6868                        mods.add(new Modifier("T", temp, x, y, centered));
6869                }
6870
6871                if(modifiers.containsKey(Modifiers.Z_SPEED))
6872                {
6873                    y = -2;
6874                    if(!strict && !modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
6875                        y++;
6876                    temp = modifiers.get(Modifiers.Z_SPEED);
6877                    if(temp != null && !temp.isEmpty())
6878                        mods.add(new Modifier("Z", temp, x, y, centered));
6879                }
6880            }
6881            else if(ss == SymbolID.SymbolSet_LandInstallation)
6882            {
6883                //No top center label
6884
6885                //Do right side labels
6886                x = 1;//on right
6887                if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
6888                {
6889                    y = 0;//center
6890                    centered = true;//vertically centered, only matters for labels on left and right side
6891                    temp = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1) + sep;
6892
6893                    if(temp != null && !temp.isEmpty())
6894                        mods.add(new Modifier("H", temp, x, y, centered));
6895                }
6896                else if(!strict)
6897                {
6898                    //if no "H', bring G and M closer to the center
6899                    centered = false;
6900                }
6901
6902                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) || modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT))
6903                {
6904                    y = 1;//above center
6905                    temp = "";
6906                    if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
6907                        temp = modifiers.get(Modifiers.G_STAFF_COMMENTS) + sep;
6908                    if(modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT))
6909                        temp += modifiers.get(Modifiers.AQ_GUARDED_UNIT);
6910                    temp = temp.trim();
6911                    if(temp != null && !temp.isEmpty())
6912                        mods.add(new Modifier("G AQ", temp, x, y, centered));
6913                }
6914
6915                if(modifiers.containsKey(Modifiers.AS_COUNTRY))
6916                {
6917                    y = 2;
6918                    if(!strict && !(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) || modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT)))
6919                        y--;
6920                    temp = modifiers.get(Modifiers.AS_COUNTRY);
6921
6922                    if(temp != null && !temp.isEmpty())
6923                        mods.add(new Modifier("AS", temp, x, y, centered));
6924                }
6925
6926                if(modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
6927                {
6928                    y = -1;//below center
6929                    temp = modifiers.get(Modifiers.M_HIGHER_FORMATION);
6930                    if(temp != null && !temp.isEmpty())
6931                        mods.add(new Modifier("M", temp, x, y, centered));
6932                }
6933
6934                if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING) ||
6935                        modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS) ||
6936                        modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
6937                {
6938                    y = -2;
6939                    if(!strict && !modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
6940                        y++;
6941                    temp = "";
6942                    if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING))
6943                        temp = modifiers.get(Modifiers.J_EVALUATION_RATING) + sep;
6944                    if(modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS))
6945                        temp += modifiers.get(Modifiers.K_COMBAT_EFFECTIVENESS) + sep;
6946                    if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
6947                        temp += modifiers.get(Modifiers.P_IFF_SIF_AIS);
6948                    temp = temp.trim();
6949                    if(temp != null && !temp.isEmpty())
6950                        mods.add(new Modifier("J K P", temp, x, y, centered));
6951                }
6952
6953                //Do left side labels
6954                x = -1;//on left
6955                centered = false;
6956
6957                if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION))
6958                {
6959                    y = 1;
6960                    temp = "";
6961                    if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
6962                        temp = modifiers.get(Modifiers.X_ALTITUDE_DEPTH) + sep;
6963                    if(modifiers.containsKey(Modifiers.Y_LOCATION))
6964                        temp += modifiers.get(Modifiers.Y_LOCATION);
6965
6966                    temp = temp.trim();
6967                    mods.add(new Modifier("X Y", temp, x, y, centered));
6968                }
6969
6970                if(modifiers.containsKey(Modifiers.W_DTG_1))
6971                {
6972                    y = 2;//above center
6973                    if(!strict && !(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION)))
6974                        y--;
6975
6976                    temp = modifiers.get(Modifiers.W_DTG_1);
6977
6978                    if(temp != null && !temp.isEmpty())
6979                        mods.add(new Modifier("W", temp, x, y, centered));
6980                }
6981
6982                if(modifiers.containsKey(Modifiers.C_QUANTITY) || modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME))
6983                {
6984                    y = -1;//below center
6985                    temp = "";
6986                    if(modifiers.containsKey(Modifiers.C_QUANTITY))
6987                        temp = modifiers.get(Modifiers.C_QUANTITY) + sep;
6988                    if(modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME))
6989                        temp += modifiers.get(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME);
6990
6991                    temp = temp.trim();
6992                    if(temp != null && !temp.isEmpty())
6993                        mods.add(new Modifier("C AE", temp, x, y, centered));
6994                }
6995
6996                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
6997                {
6998                    y = -2;
6999                    if(!strict && !(modifiers.containsKey(Modifiers.C_QUANTITY) || modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME)))
7000                        y++;
7001                    temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
7002                    if(temp != null && !temp.isEmpty())
7003                        mods.add(new Modifier("T", temp, x, y, centered));
7004                }
7005            }
7006            else if(ss == SymbolID.SymbolSet_Space ||
7007                    ss == SymbolID.SymbolSet_SpaceMissile ||
7008                    ss == SymbolID.SymbolSet_Air ||
7009                    ss == SymbolID.SymbolSet_AirMissile ||
7010                    (ss == SymbolID.SymbolSet_SignalsIntelligence &&
7011                            (fs == SymbolID.FrameShape_Space || fs == SymbolID.FrameShape_Air)))
7012            {
7013                //No top center label
7014                x = 0;//centered
7015                y = 9;//on top of symbol
7016
7017                if(modifiers.containsKey(Modifiers.C_QUANTITY))
7018                {
7019                    temp = modifiers.get(Modifiers.C_QUANTITY);
7020                    if(temp != null && !temp.isEmpty())
7021                        mods.add(new Modifier("C", temp, x, y, centered));
7022                }
7023                else if(modifiers.containsKey(Modifiers.B_ECHELON))
7024                {
7025                    temp = modifiers.get(Modifiers.B_ECHELON);
7026                    if(temp != null && !temp.isEmpty())
7027                        mods.add(new Modifier("B", temp, x, y, centered));
7028                }
7029
7030
7031                //Do right side labels
7032                x = 1;//on right
7033                centered = true;
7034
7035                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE) || modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
7036                {
7037                    y = 0;//
7038                    temp = "";
7039                    if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
7040                        temp = modifiers.get(Modifiers.V_EQUIP_TYPE) + sep;
7041                    if(modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
7042                        temp += modifiers.get(Modifiers.AF_COMMON_IDENTIFIER);
7043                    temp = temp.trim();
7044
7045                    if(temp != null && !temp.isEmpty())
7046                        mods.add(new Modifier("V AF", temp, x, y, centered));
7047                }
7048                else if(!strict)
7049                {
7050                    centered = false;
7051                }
7052
7053                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1) || modifiers.containsKey(Modifiers.Y_LOCATION))
7054                {
7055                    y = 1;//above center
7056                    temp = "";
7057                    if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
7058                        temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1) + sep;
7059                    if(modifiers.containsKey(Modifiers.Y_LOCATION))
7060                        temp += modifiers.get(Modifiers.Y_LOCATION);
7061                    temp = temp.trim();
7062
7063                    if(temp != null && !temp.isEmpty())
7064                        mods.add(new Modifier("T Y", temp, x, y, centered));
7065                }
7066
7067                if(modifiers.containsKey(Modifiers.AS_COUNTRY))
7068                {
7069                    y = 2;
7070                    if(!strict && !(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1) || modifiers.containsKey(Modifiers.Y_LOCATION)))
7071                        y--;
7072                    temp = modifiers.get(Modifiers.AS_COUNTRY);
7073
7074                    if(temp != null && !temp.isEmpty())
7075                        mods.add(new Modifier("AS", temp, x, y, centered));
7076                }
7077
7078                if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS)  ||
7079                        modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH)  ||
7080                        modifiers.containsKey(Modifiers.Z_SPEED))
7081                {
7082                    y = -1;//below center
7083                    temp = "";
7084                    if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
7085                        temp = modifiers.get(Modifiers.P_IFF_SIF_AIS) + sep;
7086                    if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
7087                        temp += modifiers.get(Modifiers.X_ALTITUDE_DEPTH) + sep;
7088                    if(modifiers.containsKey(Modifiers.Z_SPEED))
7089                        temp += modifiers.get(Modifiers.Z_SPEED);
7090
7091                    temp = temp.trim();
7092
7093                    if(temp != null && !temp.isEmpty())
7094                        mods.add(new Modifier("P X Z", temp, x, y, centered));
7095                }
7096
7097                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) ||
7098                        modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1) ||
7099                        modifiers.containsKey(Modifiers.J_EVALUATION_RATING))
7100                {
7101                    y = -2;//below center
7102                    if(!(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS)  ||
7103                            modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH)  ||
7104                            modifiers.containsKey(Modifiers.Z_SPEED)))
7105                        y++;
7106
7107                    temp = "";
7108                    if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
7109                        temp = modifiers.get(Modifiers.G_STAFF_COMMENTS) + sep;
7110                    if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
7111                        temp += modifiers.get(Modifiers.H_ADDITIONAL_INFO_1) + sep;
7112                    if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING))
7113                        temp += modifiers.get(Modifiers.J_EVALUATION_RATING);
7114                    temp = temp.trim();
7115
7116                    if(temp != null && !temp.isEmpty())
7117                        mods.add(new Modifier("G H J", temp, x, y, centered));
7118                }
7119
7120                //No left side labels
7121                x = -1;//on right
7122                centered = true;
7123
7124                if(modifiers.containsKey(Modifiers.AD_PLATFORM_TYPE))
7125                {
7126                    y = 0;//
7127                    temp = modifiers.get(Modifiers.AD_PLATFORM_TYPE);
7128
7129                    if(temp != null && !temp.isEmpty())
7130                        mods.add(new Modifier("AD", temp, x, y, centered));
7131                }
7132                else if(!strict)
7133                {
7134                    centered = false;
7135                }
7136
7137                if(modifiers.containsKey(Modifiers.AR_SPECIAL_DESIGNATOR))
7138                {
7139                    y = 1;//above center
7140                    temp = modifiers.get(Modifiers.AR_SPECIAL_DESIGNATOR);
7141
7142                    if(temp != null && !temp.isEmpty())
7143                        mods.add(new Modifier("AR", temp, x, y, centered));
7144                }
7145
7146                if(modifiers.containsKey(Modifiers.W_DTG_1))
7147                {
7148                    y = 2;
7149                    if(!strict && !modifiers.containsKey(Modifiers.AR_SPECIAL_DESIGNATOR))
7150                        y--;
7151                    temp = modifiers.get(Modifiers.W_DTG_1);
7152
7153                    if(temp != null && !temp.isEmpty())
7154                        mods.add(new Modifier("W", temp, x, y, centered));
7155                }
7156            }
7157            else if(ss == SymbolID.SymbolSet_SeaSurface ||
7158                    (ss == SymbolID.SymbolSet_SignalsIntelligence && fs == SymbolID.FrameShape_SeaSurface))
7159            {
7160                //No top center label
7161
7162
7163                //Do right side labels
7164                x = 1;//on right
7165                centered = false;
7166
7167                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
7168                {
7169                    y = 1;//above center
7170                    temp = modifiers.get(Modifiers.V_EQUIP_TYPE);
7171
7172                    if(temp != null && !temp.isEmpty())
7173                        mods.add(new Modifier("V", temp, x, y, centered));
7174                }
7175
7176                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
7177                {
7178                    y = 2;
7179                    if(!strict && !modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
7180                        y--;
7181                    temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
7182
7183                    if(temp != null && !temp.isEmpty())
7184                        mods.add(new Modifier("T", temp, x, y, centered));
7185                }
7186
7187                if(modifiers.containsKey(Modifiers.AS_COUNTRY))
7188                {
7189                    y = 3;
7190                    if(!strict)
7191                    {
7192                        if(!modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
7193                            y--;
7194                        if(!modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
7195                            y--;
7196                    }
7197
7198                    temp = modifiers.get(Modifiers.AS_COUNTRY );
7199
7200                    if(temp != null && !temp.isEmpty())
7201                        mods.add(new Modifier("AS", temp, x, y, centered));
7202                }
7203
7204                if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
7205                {
7206                    y = -1;//below center
7207                    temp = modifiers.get(Modifiers.P_IFF_SIF_AIS);
7208
7209                    if(temp != null && !temp.isEmpty())
7210                        mods.add(new Modifier("P", temp, x, y, centered));
7211                }
7212
7213                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS)  ||
7214                        modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
7215                {
7216                    y = -2;//below center
7217                    if(!modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
7218                        y++;
7219
7220                    temp = "";
7221                    if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
7222                        temp = modifiers.get(Modifiers.G_STAFF_COMMENTS) + sep;
7223                    if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
7224                        temp += modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
7225                    temp = temp.trim();
7226
7227                    if(temp != null && !temp.isEmpty())
7228                        mods.add(new Modifier("G H", temp, x, y, centered));
7229                }
7230
7231                if(modifiers.containsKey(Modifiers.Y_LOCATION) ||
7232                        modifiers.containsKey(Modifiers.Z_SPEED))
7233                {
7234                    y = -3;
7235                    if(!strict)
7236                    {
7237                        if(!(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS)  ||
7238                                modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1)))
7239                            y++;
7240                        if(!modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
7241                            y++;
7242                    }
7243                    temp = "";
7244                    if(modifiers.containsKey(Modifiers.Y_LOCATION))
7245                        temp = modifiers.get(Modifiers.Y_LOCATION) + sep;
7246                    if(modifiers.containsKey(Modifiers.Z_SPEED))
7247                        temp += modifiers.get(Modifiers.Z_SPEED);
7248                    temp = temp.trim();
7249                    if(temp != null && !temp.isEmpty())
7250                        mods.add(new Modifier("Y Z", temp, x, y, centered));
7251                }
7252
7253                //No left side labels
7254                x = -1;
7255                centered = false;
7256                if(modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT) ||
7257                        modifiers.containsKey(Modifiers.AR_SPECIAL_DESIGNATOR))
7258                {
7259                    y = 2;
7260                    if(!strict)
7261                    {
7262                        y--;
7263                    }
7264                    temp = "";
7265                    if(modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT))
7266                        temp = modifiers.get(Modifiers.AQ_GUARDED_UNIT) + sep;
7267                    if(modifiers.containsKey(Modifiers.AR_SPECIAL_DESIGNATOR))
7268                        temp += modifiers.get(Modifiers.AR_SPECIAL_DESIGNATOR);
7269                    temp = temp.trim();
7270                    if(temp != null && !temp.isEmpty())
7271                        mods.add(new Modifier("AQ AR", temp, x, y, centered));
7272                }
7273            }
7274            else if(ss == SymbolID.SymbolSet_SeaSubsurface ||
7275                    (ss == SymbolID.SymbolSet_SignalsIntelligence && fs == SymbolID.FrameShape_SeaSubsurface))
7276            {
7277                //No top center label
7278
7279
7280                //Do right side labels
7281                x = 1;//on right
7282                centered = false;
7283
7284                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
7285                {
7286                    y = 1;//above center
7287                    temp = modifiers.get(Modifiers.V_EQUIP_TYPE);
7288
7289                    if(temp != null && !temp.isEmpty())
7290                        mods.add(new Modifier("V", temp, x, y, centered));
7291                }
7292
7293                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
7294                {
7295                    y = 2;
7296                    if(!strict && !modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
7297                        y--;
7298                    temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
7299
7300                    if(temp != null && !temp.isEmpty())
7301                        mods.add(new Modifier("T", temp, x, y, centered));
7302                }
7303
7304                if(modifiers.containsKey(Modifiers.AS_COUNTRY))
7305                {
7306                    y = 3;
7307                    if(!strict)
7308                    {
7309                        if(!modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
7310                            y--;
7311                        if(!modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
7312                            y--;
7313                    }
7314
7315                    temp = modifiers.get(Modifiers.AS_COUNTRY );
7316
7317                    if(temp != null && !temp.isEmpty())
7318                        mods.add(new Modifier("AS", temp, x, y, centered));
7319                }
7320
7321                if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
7322                {
7323                    y = -1;//below center
7324                    temp = modifiers.get(Modifiers.P_IFF_SIF_AIS);
7325
7326                    if(temp != null && !temp.isEmpty())
7327                        mods.add(new Modifier("P", temp, x, y, centered));
7328                }
7329
7330                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS)  ||
7331                        modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
7332                {
7333                    y = -2;//below center
7334                    if(!modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
7335                        y++;
7336
7337                    temp = "";
7338                    if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
7339                        temp = modifiers.get(Modifiers.G_STAFF_COMMENTS) + sep;
7340                    if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
7341                        temp += modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
7342                    temp = temp.trim();
7343
7344                    if(temp != null && !temp.isEmpty())
7345                        mods.add(new Modifier("G H", temp, x, y, centered));
7346                }
7347
7348                if(modifiers.containsKey(Modifiers.Y_LOCATION) ||
7349                        modifiers.containsKey(Modifiers.Z_SPEED))
7350                {
7351                    y = -3;
7352                    if(!strict)
7353                    {
7354                        if(!(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS)  ||
7355                                modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1)))
7356                            y++;
7357                        if(!modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
7358                            y++;
7359                    }
7360                    temp = "";
7361                    if(modifiers.containsKey(Modifiers.Y_LOCATION))
7362                        temp = modifiers.get(Modifiers.Y_LOCATION) + sep;
7363                    if(modifiers.containsKey(Modifiers.Z_SPEED))
7364                        temp += modifiers.get(Modifiers.Z_SPEED);
7365                    temp = temp.trim();
7366                    if(temp != null && !temp.isEmpty())
7367                        mods.add(new Modifier("Y Z", temp, x, y, centered));
7368                }
7369
7370                //No left side labels
7371                x = -1;
7372                centered = false;
7373                if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
7374                {
7375                    y = 1;
7376                    temp = modifiers.get(Modifiers.X_ALTITUDE_DEPTH);
7377
7378                    if(temp != null && !temp.isEmpty())
7379                        mods.add(new Modifier("X", temp, x, y, centered));
7380                }
7381
7382                if(modifiers.containsKey(Modifiers.AR_SPECIAL_DESIGNATOR))
7383                {
7384                    y = 2;
7385                    if(!strict && !modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
7386                    {
7387                        y--;
7388                    }
7389                    temp = modifiers.get(Modifiers.AR_SPECIAL_DESIGNATOR);
7390                    temp = temp.trim();
7391                    if(temp != null && !temp.isEmpty())
7392                        mods.add(new Modifier("AR", temp, x, y, centered));
7393                }
7394            }
7395            else if(ss == SymbolID.SymbolSet_DismountedIndividuals)
7396            {
7397                //No top center label
7398
7399
7400                //Do right side labels
7401                x = 1;//on right
7402                if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
7403                {
7404                    y = 0;//center
7405                    centered = true;//vertically centered, only matters for labels on left and right side
7406                    temp = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
7407
7408                    if(temp != null && !temp.isEmpty())
7409                        mods.add(new Modifier("H", temp, x, y, centered));
7410                }
7411                else if(!strict)
7412                {
7413                    centered = false;
7414                }
7415
7416                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
7417                {
7418                    y = 1;//above center
7419                    temp = modifiers.get(Modifiers.G_STAFF_COMMENTS);
7420
7421                    if(temp != null && !temp.isEmpty())
7422                        mods.add(new Modifier("G", temp, x, y, centered));
7423                }
7424
7425                if(modifiers.containsKey(Modifiers.AS_COUNTRY))
7426                {
7427                    y = 2;
7428                    if(!strict && !(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS)))
7429                        y--;
7430                    temp = modifiers.get(Modifiers.AS_COUNTRY);
7431
7432                    if(temp != null && !temp.isEmpty())
7433                        mods.add(new Modifier("AS", temp, x, y, centered));
7434                }
7435
7436                if(modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
7437                {
7438                    y = -1;//below center
7439                    temp = modifiers.get(Modifiers.M_HIGHER_FORMATION);
7440                    if(temp != null && !temp.isEmpty())
7441                        mods.add(new Modifier("M", temp, x, y, centered));
7442                }
7443
7444                if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING) ||
7445                        modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS) ||
7446                        modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
7447                {
7448                    y = -2;
7449                    if(!strict && !modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
7450                        y++;
7451                    temp = "";
7452                    if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING))
7453                        temp = modifiers.get(Modifiers.J_EVALUATION_RATING) + sep;
7454                    if(modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS))
7455                        temp += modifiers.get(Modifiers.K_COMBAT_EFFECTIVENESS) + sep;
7456                    if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
7457                        temp += modifiers.get(Modifiers.P_IFF_SIF_AIS);
7458                    temp = temp.trim();
7459                    if(temp != null && !temp.isEmpty())
7460                        mods.add(new Modifier("J K P", temp, x, y, centered));
7461                }
7462
7463                //Do left side labels
7464                x = -1;//on left
7465
7466                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE) ||
7467                        modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
7468                {
7469                    y = 0;//center
7470                    centered = true;//vertically centered, only matters for labels on left and right side
7471
7472                    temp = "";
7473                    if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
7474                        temp = modifiers.get(Modifiers.V_EQUIP_TYPE) + sep;
7475                    if(modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
7476                        temp += modifiers.get(Modifiers.AF_COMMON_IDENTIFIER);
7477                    temp = temp.trim();
7478                    if(temp != null && !temp.isEmpty())
7479                        mods.add(new Modifier("V AF", temp, x, y, centered));
7480                }
7481                else if(!strict)
7482                {
7483                    centered = false;
7484                }
7485
7486                if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION))
7487                {
7488                    y = 1;
7489                    temp = "";
7490                    if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
7491                        temp = modifiers.get(Modifiers.X_ALTITUDE_DEPTH) + sep;
7492                    if(modifiers.containsKey(Modifiers.Y_LOCATION))
7493                        temp += modifiers.get(Modifiers.Y_LOCATION);
7494
7495                    temp = temp.trim();
7496                    mods.add(new Modifier("X Y", temp, x, y, centered));
7497                }
7498
7499                if(modifiers.containsKey(Modifiers.W_DTG_1))
7500                {
7501                    y = 2;//above center
7502                    if(!strict && !(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION)))
7503                        y--;
7504
7505                    temp = modifiers.get(Modifiers.W_DTG_1);
7506
7507                    if(temp != null && !temp.isEmpty())
7508                        mods.add(new Modifier("W", temp, x, y, centered));
7509                }
7510
7511                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
7512                {
7513                    y = -1;//below center
7514                    temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
7515
7516                    if(temp != null && !temp.isEmpty())
7517                        mods.add(new Modifier("T", temp, x, y, centered));
7518                }
7519
7520                if(modifiers.containsKey(Modifiers.Z_SPEED))
7521                {
7522                    y = -2;
7523                    if(!strict && !(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)))
7524                        y++;
7525                    temp = modifiers.get(Modifiers.Z_SPEED);
7526                    if(temp != null && !temp.isEmpty())
7527                        mods.add(new Modifier("Z", temp, x, y, centered));
7528                }
7529            }
7530            else if(ss == SymbolID.SymbolSet_Activities)
7531            {
7532                //No top center label
7533
7534
7535                //Do right side labels
7536                x = 1;//on right
7537                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
7538                {
7539                    y = 0;//center
7540                    centered = true;//vertically centered, only matters for labels on left and right side
7541                    temp = modifiers.get(Modifiers.G_STAFF_COMMENTS);
7542
7543                    if(temp != null && !temp.isEmpty())
7544                        mods.add(new Modifier("G", temp, x, y, centered));
7545                }
7546                else if(!strict)
7547                {
7548                    centered = false;
7549                }
7550
7551                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
7552                {
7553                    y = 1;//above center
7554                    temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
7555
7556                    if(temp != null && !temp.isEmpty())
7557                        mods.add(new Modifier("T", temp, x, y, centered));
7558                }
7559
7560                if(modifiers.containsKey(Modifiers.AS_COUNTRY))
7561                {
7562                    y = 2;
7563                    if(!strict && !(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)))
7564                        y--;
7565                    temp = modifiers.get(Modifiers.AS_COUNTRY);
7566
7567                    if(temp != null && !temp.isEmpty())
7568                        mods.add(new Modifier("AS", temp, x, y, centered));
7569                }
7570
7571                if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
7572                {
7573                    y = -1;//below center
7574                    temp = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
7575                    if(temp != null && !temp.isEmpty())
7576                        mods.add(new Modifier("H", temp, x, y, centered));
7577                }
7578
7579                if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING))
7580                {
7581                    y = -2;
7582                    if(!strict && !modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
7583                        y++;
7584                    temp = modifiers.get(Modifiers.J_EVALUATION_RATING);
7585
7586                    if(temp != null && !temp.isEmpty())
7587                        mods.add(new Modifier("J", temp, x, y, centered));
7588                }
7589
7590                //Do left side labels
7591                x = -1;//on left
7592
7593                if(!strict)
7594                {
7595                    centered = false;
7596                }
7597
7598                if(modifiers.containsKey(Modifiers.Y_LOCATION))
7599                {
7600                    y = 1;
7601                    temp = modifiers.get(Modifiers.Y_LOCATION);
7602
7603                    if(temp != null && !temp.isEmpty())
7604                        mods.add(new Modifier("Y", temp, x, y, centered));
7605                }
7606
7607                if(modifiers.containsKey(Modifiers.W_DTG_1))
7608                {
7609                    y = 2;//above center
7610                    if(!strict && !(modifiers.containsKey(Modifiers.Y_LOCATION)))
7611                        y--;
7612
7613                    temp = modifiers.get(Modifiers.W_DTG_1);
7614
7615                    if(temp != null && !temp.isEmpty())
7616                        mods.add(new Modifier("W", temp, x, y, centered));
7617                }
7618
7619                if(modifiers.containsKey(Modifiers.C_QUANTITY))
7620                {
7621                    y = -1;//below center
7622                    temp = modifiers.get(Modifiers.C_QUANTITY);
7623
7624                    if(temp != null && !temp.isEmpty())
7625                        mods.add(new Modifier("C", temp, x, y, centered));
7626                }
7627
7628            }
7629            else if(ss == SymbolID.SymbolSet_CyberSpace ||
7630                    (ss == SymbolID.SymbolSet_SignalsIntelligence && fs == SymbolID.FrameShape_Cyberspace))
7631            {
7632                //Do top center label
7633                x = 0;//centered
7634                y = 9;//on top of symbol
7635                if(modifiers.containsKey(Modifiers.B_ECHELON))
7636                {
7637                    temp = modifiers.get(Modifiers.B_ECHELON);
7638                    if(temp != null && !temp.isEmpty())
7639                        mods.add(new Modifier("B", temp, x, y, centered));
7640                }
7641
7642                //Do right side labels
7643                x = 1;//on right
7644                if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
7645                {
7646                    y = 0;//center
7647                    centered = true;//vertically centered, only matters for labels on left and right side
7648                    temp = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
7649
7650                    if(temp != null && !temp.isEmpty())
7651                        mods.add(new Modifier("H", temp, x, y, centered));
7652                }
7653                else if(!strict)
7654                {
7655                    centered = false;
7656                }
7657
7658                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
7659                {
7660                    y = 1;//above center
7661                    temp = modifiers.get(Modifiers.G_STAFF_COMMENTS);
7662
7663                    if(temp != null && !temp.isEmpty())
7664                        mods.add(new Modifier("G", temp, x, y, centered));
7665                }
7666
7667                if(modifiers.containsKey(Modifiers.F_REINFORCED_REDUCED) || modifiers.containsKey(Modifiers.AS_COUNTRY))
7668                {
7669                    y = 2;
7670                    if(!strict && !(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS)))
7671                        y--;
7672                    temp = "";
7673                    if(modifiers.containsKey(Modifiers.F_REINFORCED_REDUCED))
7674                        temp = modifiers.get(Modifiers.F_REINFORCED_REDUCED) + sep;
7675                    if(modifiers.containsKey(Modifiers.AS_COUNTRY))
7676                        temp += modifiers.get(Modifiers.AS_COUNTRY);
7677                    temp = temp.trim();
7678                    if(temp != null && !temp.isEmpty())
7679                        mods.add(new Modifier("F AS", temp, x, y, centered));
7680                }
7681
7682                if(modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
7683                {
7684                    y = -1;//below center
7685                    temp = modifiers.get(Modifiers.M_HIGHER_FORMATION);
7686                    if(temp != null && !temp.isEmpty())
7687                        mods.add(new Modifier("M", temp, x, y, centered));
7688                }
7689
7690                if(modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS) || modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP))
7691                {
7692                    y = -2;
7693                    if(!strict && !modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
7694                        y++;
7695                    temp = "";
7696                    if(modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS))
7697                        temp = modifiers.get(Modifiers.K_COMBAT_EFFECTIVENESS) + sep;
7698                    if(modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP))
7699                        temp += modifiers.get(Modifiers.L_SIGNATURE_EQUIP);
7700                    temp = temp.trim();
7701                    if(temp != null && !temp.isEmpty())
7702                        mods.add(new Modifier("K L", temp, x, y, centered));
7703                }
7704
7705                //Do left side labels
7706                x=-1;
7707                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
7708                {
7709                    y = 0;//center
7710                    centered = true;//vertically centered, only matters for labels on left and right side
7711
7712                    temp = modifiers.get(Modifiers.V_EQUIP_TYPE);
7713
7714                    if(temp != null && !temp.isEmpty())
7715                        mods.add(new Modifier("V", temp, x, y, centered));
7716                }
7717                else if(!strict)
7718                {
7719                    centered = false;
7720                }
7721
7722                if(modifiers.containsKey(Modifiers.Y_LOCATION))
7723                {
7724                    y = 1;
7725                    temp = modifiers.get(Modifiers.Y_LOCATION);
7726
7727                    if(temp != null && !temp.isEmpty())
7728                        mods.add(new Modifier("Y", temp, x, y, centered));
7729                }
7730
7731                if(modifiers.containsKey(Modifiers.W_DTG_1))
7732                {
7733                    y = 2;//above center
7734                    if(!strict && !(modifiers.containsKey(Modifiers.Y_LOCATION)))
7735                        y--;
7736
7737                    temp = modifiers.get(Modifiers.W_DTG_1);
7738
7739                    if(temp != null && !temp.isEmpty())
7740                        mods.add(new Modifier("W", temp, x, y, centered));
7741                }
7742
7743                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
7744                {
7745                    y = -1;//below center
7746                    temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
7747
7748                    if(temp != null && !temp.isEmpty())
7749                        mods.add(new Modifier("T", temp, x, y, centered));
7750                }
7751            }
7752            /*else if(ver == SymbolID.SymbolSet_MineWarfare)
7753            {
7754                //no modifiers
7755            }//*/
7756            //else//SymbolSet Unknown
7757            //processUnknownTextModifiers
7758        }
7759        else if(ver == SymbolID.Version_APP6D || ver == SymbolID.Version_APP6Ech2)
7760        {
7761            int fs = SymbolID.getFrameShape(symbolID);
7762            if(ss == SymbolID.SymbolSet_LandUnit ||
7763                    ss == SymbolID.SymbolSet_LandCivilianUnit_Organization)
7764            {
7765
7766                //Only Command & Control has AA; ec.equals("110000").  Always in the middle of the unit.
7767                if(modifiers.containsKey(Modifiers.AA_SPECIAL_C2_HQ))
7768                {
7769                    temp = modifiers.get(Modifiers.AA_SPECIAL_C2_HQ);
7770                    if(temp != null && !temp.isEmpty())
7771                        mods.add(new Modifier("AA", temp, 0, 0, true));
7772                }
7773
7774                //Do top center label
7775                x = 0;//centered
7776                y = 9;//on top of symbol
7777                if(modifiers.containsKey(Modifiers.B_ECHELON))
7778                {
7779                    temp = modifiers.get(Modifiers.B_ECHELON);
7780                    if(temp != null && !temp.isEmpty())
7781                        mods.add(new Modifier("B", temp, x, y, centered));
7782                }
7783
7784                x = 0;//centered
7785                y = -9;//on bottom of symbol
7786                if(ver == SymbolID.Version_APP6Ech2 && modifiers.containsKey(Modifiers.AW_HEADQUARTERS_ELEMENT))
7787                {
7788                    temp = modifiers.get(Modifiers.AW_HEADQUARTERS_ELEMENT);
7789                    if(temp != null && !temp.isEmpty())
7790                        mods.add(new Modifier("AW", temp, x, y, centered));
7791                }
7792
7793                //Do right side labels
7794                x = 1;//on right
7795                if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1) ||
7796                        modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
7797                {
7798                    y = 0;//center
7799                    centered = true;//vertically centered, only matters for labels on left and right side
7800                    temp = "";
7801                    if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
7802                        temp = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1) + sep;
7803                    if(modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
7804                        temp += modifiers.get(Modifiers.AF_COMMON_IDENTIFIER);
7805                    temp = temp.trim();
7806                    if(temp != null && !temp.isEmpty())
7807                        mods.add(new Modifier("H AF", temp, x, y, centered));
7808                }
7809                else if(!strict)
7810                {
7811                    //if no "H', bring G and M closer to the center
7812                    centered = false;
7813                }
7814
7815                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) || modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT))
7816                {
7817                    y = 1;//above center
7818                    temp = "";
7819                    if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
7820                        temp = modifiers.get(Modifiers.G_STAFF_COMMENTS) + sep;
7821                    if(modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT))
7822                        temp += modifiers.get(Modifiers.AQ_GUARDED_UNIT);
7823                    temp = temp.trim();
7824                    if(temp != null && !temp.isEmpty())
7825                        mods.add(new Modifier("G AQ", temp, x, y, centered));
7826                }
7827
7828                if(modifiers.containsKey(Modifiers.F_REINFORCED_REDUCED) || modifiers.containsKey(Modifiers.AS_COUNTRY))
7829                {
7830                    y = 2;
7831                    if(!strict && !(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) || modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT)))
7832                        y--;
7833                    temp = "";
7834                    if(modifiers.containsKey(Modifiers.F_REINFORCED_REDUCED))
7835                        temp = modifiers.get(Modifiers.F_REINFORCED_REDUCED) + sep;
7836                    if(modifiers.containsKey(Modifiers.AS_COUNTRY))
7837                        temp += modifiers.get(Modifiers.AS_COUNTRY);
7838                    temp = temp.trim();
7839                    if(temp != null && !temp.isEmpty())
7840                        mods.add(new Modifier("F AS", temp, x, y, centered));
7841                }
7842
7843                if(modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
7844                {
7845                    y = -1;//below center
7846                    temp = modifiers.get(Modifiers.M_HIGHER_FORMATION);
7847                    if(temp != null && !temp.isEmpty())
7848                        mods.add(new Modifier("M", temp, x, y, centered));
7849                }
7850
7851                if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING) ||
7852                        modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS) ||
7853                        modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP) ||
7854                        modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
7855                {
7856                    y = -2;
7857                    if(!strict && !modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
7858                        y++;
7859                    temp = "";
7860                    if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING))
7861                        temp = modifiers.get(Modifiers.J_EVALUATION_RATING) + sep;
7862                    if(modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS))
7863                        temp += modifiers.get(Modifiers.K_COMBAT_EFFECTIVENESS) + sep;
7864                    if(modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP))
7865                        temp += modifiers.get(Modifiers.L_SIGNATURE_EQUIP) + sep;
7866                    if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
7867                        temp += modifiers.get(Modifiers.P_IFF_SIF_AIS);
7868                    temp = temp.trim();
7869                    if(temp != null && !temp.isEmpty())
7870                        mods.add(new Modifier("J K L P", temp, x, y, centered));
7871                }
7872
7873                //Do left side labels
7874                x = -1;//on left
7875
7876                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE) ||
7877                        modifiers.containsKey(Modifiers.AD_PLATFORM_TYPE) ||
7878                        modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME))
7879                {
7880                    y = 0;//center
7881                    centered = true;//vertically centered, only matters for labels on left and right side
7882
7883                    temp = "";
7884                    if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
7885                        temp = modifiers.get(Modifiers.V_EQUIP_TYPE) + sep;
7886                    if(modifiers.containsKey(Modifiers.AD_PLATFORM_TYPE))
7887                        temp += modifiers.get(Modifiers.AD_PLATFORM_TYPE) + sep;
7888                    if(modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME))
7889                        temp += modifiers.get(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME);
7890                    temp = temp.trim();
7891                    if(temp != null && !temp.isEmpty())
7892                        mods.add(new Modifier("V AD AE", temp, x, y, centered));
7893                }
7894                else if(!strict)
7895                {
7896                    centered = false;
7897                }
7898
7899                if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION))
7900                {
7901                    y = 1;
7902                    temp = "";
7903                    if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
7904                        temp = modifiers.get(Modifiers.X_ALTITUDE_DEPTH) + sep;
7905                    if(modifiers.containsKey(Modifiers.Y_LOCATION))
7906                        temp += modifiers.get(Modifiers.Y_LOCATION);
7907
7908                    temp = temp.trim();
7909                    mods.add(new Modifier("X Y", temp, x, y, centered));
7910                }
7911
7912                if(modifiers.containsKey(Modifiers.W_DTG_1))
7913                {
7914                    y = 2;//above center
7915                    if(!strict && !(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION)))
7916                        y--;
7917
7918                    temp = modifiers.get(Modifiers.W_DTG_1);
7919
7920                    if(temp != null && !temp.isEmpty())
7921                        mods.add(new Modifier("W", temp, x, y, centered));
7922                }
7923
7924                if(modifiers.containsKey(Modifiers.C_QUANTITY) || modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
7925                {
7926                    y = -1;//below center
7927                    temp = "";
7928                    if(modifiers.containsKey(Modifiers.C_QUANTITY))
7929                        temp = modifiers.get(Modifiers.C_QUANTITY) + sep;
7930                    if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
7931                        temp += modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
7932
7933                    temp = temp.trim();
7934                    if(temp != null && !temp.isEmpty())
7935                        mods.add(new Modifier("C T", temp, x, y, centered));
7936                }
7937
7938                if(modifiers.containsKey(Modifiers.Z_SPEED))
7939                {
7940                    y = -2;
7941                    if(!strict && !(modifiers.containsKey(Modifiers.C_QUANTITY) || modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)))
7942                        y++;
7943                    temp = modifiers.get(Modifiers.Z_SPEED);
7944                    if(temp != null && !temp.isEmpty())
7945                        mods.add(new Modifier("Z", temp, x, y, centered));
7946                }
7947            }
7948            else if(ss == SymbolID.SymbolSet_LandEquipment)
7949            {
7950                //Do top center label
7951                x = 0;//centered
7952                y = 9;//on top of symbol
7953                if(modifiers.containsKey(Modifiers.C_QUANTITY))
7954                {
7955                    temp = modifiers.get(Modifiers.C_QUANTITY);
7956                    if(temp != null && !temp.isEmpty())
7957                        mods.add(new Modifier("C", temp, x, y, centered));
7958                }
7959
7960                //Do right side labels
7961                x = 1;//on right
7962                centered = false;
7963
7964                if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1) ||
7965                        modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME))
7966                {
7967                    y = 0;
7968                    centered = true;
7969                    temp = "";
7970                    if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
7971                        temp = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1) + sep;
7972                    if(modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME))
7973                        temp += modifiers.get(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME);
7974                    temp = temp.trim();
7975                    if(temp != null && !temp.isEmpty())
7976                        mods.add(new Modifier("H AE", temp, x, y, centered));
7977                }
7978                else if(!strict)
7979                {
7980                    centered = false;
7981                }
7982
7983                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) || modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT))
7984                {
7985                    y = 1;//above center
7986                    temp = "";
7987                    if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
7988                        temp = modifiers.get(Modifiers.G_STAFF_COMMENTS) + sep;
7989                    if(modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT))
7990                        temp += modifiers.get(Modifiers.AQ_GUARDED_UNIT);
7991                    temp = temp.trim();
7992                    if(temp != null && !temp.isEmpty())
7993                        mods.add(new Modifier("G AQ", temp, x, y, centered));
7994                }
7995
7996                if( modifiers.containsKey(Modifiers.AS_COUNTRY))
7997                {
7998                    y = 2;
7999                    if(!strict && !(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) || modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT)))
8000                        y--;
8001                    temp = modifiers.get(Modifiers.AS_COUNTRY);
8002
8003                    if(temp != null && !temp.isEmpty())
8004                        mods.add(new Modifier("AS", temp, x, y, centered));
8005                }
8006
8007                if( modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
8008                {
8009                    y = -1;
8010                    if(!strict && !(modifiers.containsKey(Modifiers.M_HIGHER_FORMATION)))
8011                        y++;
8012                    temp = modifiers.get(Modifiers.M_HIGHER_FORMATION);
8013
8014                    if(temp != null && !temp.isEmpty())
8015                        mods.add(new Modifier("M", temp, x, y, centered));
8016                }
8017
8018                if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING) ||
8019                        modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS) ||
8020                        modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP) ||
8021                        modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
8022                {
8023                    y = -2;
8024                    if(!strict && !(modifiers.containsKey(Modifiers.M_HIGHER_FORMATION)))
8025                        y++;
8026                    temp = "";
8027                    if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING))
8028                        temp = modifiers.get(Modifiers.J_EVALUATION_RATING) + sep;
8029                    if(modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS))
8030                        temp += modifiers.get(Modifiers.K_COMBAT_EFFECTIVENESS) + sep;
8031                    if(modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP))
8032                        temp += modifiers.get(Modifiers.L_SIGNATURE_EQUIP) + sep;
8033                    if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
8034                        temp += modifiers.get(Modifiers.P_IFF_SIF_AIS);
8035                    temp = temp.trim();
8036                    if(temp != null && !temp.isEmpty())
8037                        mods.add(new Modifier("J K L P", temp, x, y, centered));
8038                }
8039
8040                //Do left side labels
8041                x = -1;//on left
8042
8043                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE) ||
8044                        modifiers.containsKey(Modifiers.AD_PLATFORM_TYPE) ||
8045                        modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME))
8046                {
8047                    y = 0;//center
8048                    centered = true;//vertically centered, only matters for labels on left and right side
8049
8050                    temp = "";
8051                    if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
8052                        temp = modifiers.get(Modifiers.V_EQUIP_TYPE) + sep;
8053                    if(modifiers.containsKey(Modifiers.AD_PLATFORM_TYPE))
8054                        temp += modifiers.get(Modifiers.AD_PLATFORM_TYPE) + sep;
8055                    if(modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
8056                        temp += modifiers.get(Modifiers.AF_COMMON_IDENTIFIER);
8057                    temp = temp.trim();
8058                    if(temp != null && !temp.isEmpty())
8059                        mods.add(new Modifier("V AD AF", temp, x, y, centered));
8060                }
8061                else if(!strict)
8062                {
8063                    centered = false;
8064                }
8065
8066                if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION))
8067                {
8068                    y = 1;
8069                    temp = "";
8070                    if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
8071                        temp = modifiers.get(Modifiers.X_ALTITUDE_DEPTH) + sep;
8072                    if(modifiers.containsKey(Modifiers.Y_LOCATION))
8073                        temp += modifiers.get(Modifiers.Y_LOCATION);
8074
8075                    temp = temp.trim();
8076                    mods.add(new Modifier("X Y", temp, x, y, centered));
8077                }
8078
8079                if(modifiers.containsKey(Modifiers.W_DTG_1))
8080                {
8081                    y = 2;//above center
8082                    if(!strict && !(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION)))
8083                        y--;
8084
8085                    temp = modifiers.get(Modifiers.W_DTG_1);
8086
8087                    if(temp != null && !temp.isEmpty())
8088                        mods.add(new Modifier("W", temp, x, y, centered));
8089                }
8090
8091                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
8092                {
8093                    y = -1;//below center
8094                    temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
8095
8096                    temp = temp.trim();
8097                    if(temp != null && !temp.isEmpty())
8098                        mods.add(new Modifier("T", temp, x, y, centered));
8099                }
8100
8101                if(modifiers.containsKey(Modifiers.Z_SPEED))
8102                {
8103                    y = -2;
8104                    if(!strict && !modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
8105                        y++;
8106                    temp = modifiers.get(Modifiers.Z_SPEED);
8107                    if(temp != null && !temp.isEmpty())
8108                        mods.add(new Modifier("Z", temp, x, y, centered));
8109                }
8110            }
8111            else if(ss == SymbolID.SymbolSet_LandInstallation)
8112            {
8113                //No top center label
8114
8115                //Do right side labels
8116                x = 1;//on right
8117                if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1) || modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME))
8118                {
8119                    y = 0;//center
8120                    centered = true;//vertically centered, only matters for labels on left and right side
8121                    temp = "";
8122                    if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
8123                        temp = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1) + sep;
8124                    if(modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME))
8125                        temp += modifiers.get(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME);
8126                    temp = temp.trim();
8127
8128                    if(temp != null && !temp.isEmpty())
8129                        mods.add(new Modifier("H AE", temp, x, y, centered));
8130                }
8131                else if(!strict)
8132                {
8133                    //if no "H', bring G and M closer to the center
8134                    centered = false;
8135                }
8136
8137                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) || modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT))
8138                {
8139                    y = 1;//above center
8140                    temp = "";
8141                    if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
8142                        temp = modifiers.get(Modifiers.G_STAFF_COMMENTS) + sep;
8143                    if(modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT))
8144                        temp += modifiers.get(Modifiers.AQ_GUARDED_UNIT);
8145                    temp = temp.trim();
8146                    if(temp != null && !temp.isEmpty())
8147                        mods.add(new Modifier("G AQ", temp, x, y, centered));
8148                }
8149
8150                if(modifiers.containsKey(Modifiers.AS_COUNTRY))
8151                {
8152                    y = 2;
8153                    if(!strict && !(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) || modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT)))
8154                        y--;
8155                    temp = modifiers.get(Modifiers.AS_COUNTRY);
8156
8157                    if(temp != null && !temp.isEmpty())
8158                        mods.add(new Modifier("AS", temp, x, y, centered));
8159                }
8160
8161                if(modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
8162                {
8163                    y = -1;//below center
8164                    temp = modifiers.get(Modifiers.M_HIGHER_FORMATION);
8165                    if(temp != null && !temp.isEmpty())
8166                        mods.add(new Modifier("M", temp, x, y, centered));
8167                }
8168
8169                if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING) ||
8170                        modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS) ||
8171                        modifiers.containsKey(Modifiers.AT_CAPACITY_OF_INSTALLATION))
8172                {
8173                    y = -2;
8174                    if(!strict && !modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
8175                        y++;
8176                    temp = "";
8177                    if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING))
8178                        temp = modifiers.get(Modifiers.J_EVALUATION_RATING) + sep;
8179                    if(modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS))
8180                        temp += modifiers.get(Modifiers.K_COMBAT_EFFECTIVENESS) + sep;
8181                    if(modifiers.containsKey(Modifiers.AT_CAPACITY_OF_INSTALLATION))
8182                        temp += modifiers.get(Modifiers.AT_CAPACITY_OF_INSTALLATION);
8183                    temp = temp.trim();
8184                    if(temp != null && !temp.isEmpty())
8185                        mods.add(new Modifier("J K AT", temp, x, y, centered));
8186                }
8187
8188                //Do left side labels
8189                x = -1;//on left
8190                centered = false;
8191
8192                if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION))
8193                {
8194                    y = 0;//center
8195                    centered = true;//vertically centered, only matters for labels on left and right side
8196
8197                    temp = "";
8198                    if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
8199                        temp = modifiers.get(Modifiers.X_ALTITUDE_DEPTH) + sep;
8200                    if(modifiers.containsKey(Modifiers.Y_LOCATION))
8201                        temp += modifiers.get(Modifiers.Y_LOCATION);
8202                    temp = temp.trim();
8203                    if(temp != null && !temp.isEmpty())
8204                        mods.add(new Modifier("X Y", temp, x, y, centered));
8205                }
8206                else if(!strict)
8207                {
8208                    centered = false;
8209                }
8210
8211                if(modifiers.containsKey(Modifiers.W_DTG_1))
8212                {
8213                    y = 1;//above center
8214
8215                    temp = modifiers.get(Modifiers.W_DTG_1);
8216
8217                    if(temp != null && !temp.isEmpty())
8218                        mods.add(new Modifier("W AR", temp, x, y, centered));
8219                }
8220
8221                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
8222                {
8223                    y = -1;//below center
8224                    temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
8225                    if(temp != null && !temp.isEmpty())
8226                        mods.add(new Modifier("T", temp, x, y, centered));
8227                }
8228            }
8229            else if(ss == SymbolID.SymbolSet_Air ||
8230                    ss == SymbolID.SymbolSet_AirMissile)
8231            {
8232                //No top center label
8233
8234
8235                //Do right side labels
8236                x = 1;//on right
8237                centered = false;
8238
8239                centered = true;
8240                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
8241                {
8242                    y = 0;//center
8243                    centered = true;//vertically centered, only matters for labels on left and right side
8244                    temp = modifiers.get(Modifiers.V_EQUIP_TYPE);
8245                    if(temp != null && !temp.isEmpty())
8246                        mods.add(new Modifier("V", temp, x, y, centered));
8247                }
8248                else if(!strict)
8249                {
8250                    //if no "H', bring G and M closer to the center
8251                    centered = false;
8252                }
8253
8254                if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
8255                {
8256                    y = 1;//above center
8257                    temp = modifiers.get(Modifiers.P_IFF_SIF_AIS);
8258
8259                    if(temp != null && !temp.isEmpty())
8260                        mods.add(new Modifier("P", temp, x, y, centered));
8261                }
8262
8263                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1) || modifiers.containsKey(Modifiers.AS_COUNTRY))
8264                {
8265                    y = 2;
8266                    if(!strict && !modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
8267                        y--;
8268                    temp = "";
8269                    if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
8270                        temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1) + sep;
8271                    if(modifiers.containsKey(Modifiers.AS_COUNTRY))
8272                        temp += modifiers.get(Modifiers.AS_COUNTRY);
8273                    temp = temp.trim();
8274
8275                    if(temp != null && !temp.isEmpty())
8276                        mods.add(new Modifier("T AS", temp, x, y, centered));
8277                }
8278
8279                if(modifiers.containsKey(Modifiers.Z_SPEED)  ||
8280                        modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
8281                {
8282                    y = -1;//below center
8283
8284                    temp = "";
8285                    if(modifiers.containsKey(Modifiers.Z_SPEED))
8286                        temp = modifiers.get(Modifiers.Z_SPEED) + sep;
8287                    if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
8288                        temp += modifiers.get(Modifiers.X_ALTITUDE_DEPTH);
8289                    temp = temp.trim();
8290
8291                    if(temp != null && !temp.isEmpty())
8292                        mods.add(new Modifier("Z X", temp, x, y, centered));
8293                }
8294
8295                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) ||
8296                        modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
8297                {
8298                    y = -2;
8299                    if(!strict)
8300                    {
8301                        if(!(modifiers.containsKey(Modifiers.Z_SPEED)  ||
8302                                modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH)))
8303                            y++;
8304                    }
8305                    temp = "";
8306                    if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
8307                        temp = modifiers.get(Modifiers.G_STAFF_COMMENTS) + sep;
8308                    if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
8309                        temp += modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
8310                    temp = temp.trim();
8311                    if(temp != null && !temp.isEmpty())
8312                        mods.add(new Modifier("G H", temp, x, y, centered));
8313                }
8314
8315                //No left side labels
8316
8317            }
8318            else if(ss == SymbolID.SymbolSet_Space ||
8319                    ss == SymbolID.SymbolSet_SpaceMissile)
8320            {
8321                //No top center label
8322
8323
8324                //Do right side labels
8325                x = 1;//on right
8326                centered = false;
8327
8328                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
8329                {
8330                    y = 1;//above center
8331                    temp = modifiers.get(Modifiers.V_EQUIP_TYPE);
8332                    if(temp != null && !temp.isEmpty())
8333                        mods.add(new Modifier("V", temp, x, y, centered));
8334                }
8335
8336                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1) || modifiers.containsKey(Modifiers.AS_COUNTRY))
8337                {
8338                    y = 2;
8339                    if(!strict && !modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
8340                        y--;
8341                    temp = "";
8342                    if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
8343                        temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1) + sep;
8344                    if(modifiers.containsKey(Modifiers.AS_COUNTRY))
8345                        temp += modifiers.get(Modifiers.AS_COUNTRY);
8346                    temp = temp.trim();
8347
8348                    if(temp != null && !temp.isEmpty())
8349                        mods.add(new Modifier("T AS", temp, x, y, centered));
8350                }
8351
8352                if(modifiers.containsKey(Modifiers.Z_SPEED)  ||
8353                        modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
8354                {
8355                    y = -1;//below center
8356                    temp = "";
8357                    if(modifiers.containsKey(Modifiers.Z_SPEED))
8358                        temp = modifiers.get(Modifiers.Z_SPEED) + sep;
8359                    if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
8360                        temp += modifiers.get(Modifiers.X_ALTITUDE_DEPTH);
8361                    temp = temp.trim();
8362
8363                    if(temp != null && !temp.isEmpty())
8364                        mods.add(new Modifier("Z X", temp, x, y, centered));
8365                }
8366
8367                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) ||
8368                        modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
8369                {
8370                    y = -2;
8371                    if(!strict &&
8372                            !(modifiers.containsKey(Modifiers.Z_SPEED) || modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH)))
8373                        y++;
8374                    temp = "";
8375                    if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
8376                        temp = modifiers.get(Modifiers.G_STAFF_COMMENTS) + sep;
8377                    if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
8378                        temp += modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
8379                    temp = temp.trim();
8380                    if(temp != null && !temp.isEmpty())
8381                        mods.add(new Modifier("G H", temp, x, y, centered));
8382                }
8383
8384                //No left side labels
8385            }
8386            else if(ss == SymbolID.SymbolSet_SeaSurface)
8387            {
8388                //No top center label
8389
8390
8391                //Do right side labels
8392                x = 1;//on right
8393                centered = true;
8394                if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
8395                {
8396                    y = 0;//center
8397                    centered = true;//vertically centered, only matters for labels on left and right side
8398                    temp = modifiers.get(Modifiers.P_IFF_SIF_AIS);
8399                    if(temp != null && !temp.isEmpty())
8400                        mods.add(new Modifier("P", temp, x, y, centered));
8401                }
8402                else if(!strict)
8403                {
8404                    //if no "X', bring V and G closer to the center
8405                    centered = false;
8406                }
8407
8408                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
8409                {
8410                    y = 1;//above center
8411                    temp = modifiers.get(Modifiers.V_EQUIP_TYPE);
8412                    if(temp != null && !temp.isEmpty())
8413                        mods.add(new Modifier("V", temp, x, y, centered));
8414                }
8415
8416                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1) || modifiers.containsKey(Modifiers.AS_COUNTRY))
8417                {
8418                    y = 2;
8419                    if(!strict && !modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
8420                        y--;
8421                    temp = "";
8422                    if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
8423                        temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1) + sep;
8424                    if(modifiers.containsKey(Modifiers.AS_COUNTRY))
8425                        temp += modifiers.get(Modifiers.AS_COUNTRY);
8426                    temp = temp.trim();
8427
8428                    if(temp != null && !temp.isEmpty())
8429                        mods.add(new Modifier("T AS", temp, x, y, centered));
8430                }
8431
8432
8433                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS)  ||
8434                        modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
8435                {
8436                    y = -1;//below center
8437                    temp = "";
8438                    if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
8439                        temp = modifiers.get(Modifiers.G_STAFF_COMMENTS) + sep;
8440                    if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
8441                        temp += modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
8442                    temp = temp.trim();
8443
8444                    if(temp != null && !temp.isEmpty())
8445                        mods.add(new Modifier("G H", temp, x, y, centered));
8446                }
8447
8448                if(modifiers.containsKey(Modifiers.Y_LOCATION) ||
8449                        modifiers.containsKey(Modifiers.Z_SPEED))
8450                {
8451                    y = -2;
8452                    if(!strict &&
8453                            !(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) || modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1)))
8454                        y++;
8455                    temp = "";
8456                    if(modifiers.containsKey(Modifiers.Y_LOCATION))
8457                        temp = modifiers.get(Modifiers.Y_LOCATION) + sep;
8458                    if(modifiers.containsKey(Modifiers.Z_SPEED))
8459                        temp += modifiers.get(Modifiers.Z_SPEED);
8460                    temp = temp.trim();
8461                    if(temp != null && !temp.isEmpty())
8462                        mods.add(new Modifier("Y Z", temp, x, y, centered));
8463                }
8464
8465                //No left side labels
8466                x = -1;
8467                centered = false;
8468                if(modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT) ||
8469                        modifiers.containsKey(Modifiers.AR_SPECIAL_DESIGNATOR))
8470                {
8471                    y = 2;
8472                    if(!strict)
8473                    {
8474                        y--;
8475                    }
8476                    temp = "";
8477                    if(modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT))
8478                        temp = modifiers.get(Modifiers.AQ_GUARDED_UNIT) + sep;
8479                    if(modifiers.containsKey(Modifiers.AR_SPECIAL_DESIGNATOR))
8480                        temp += modifiers.get(Modifiers.AR_SPECIAL_DESIGNATOR);
8481                    temp = temp.trim();
8482                    if(temp != null && !temp.isEmpty())
8483                        mods.add(new Modifier("AQ AR", temp, x, y, centered));
8484                }
8485            }
8486            else if(ss == SymbolID.SymbolSet_SeaSubsurface)
8487            {
8488                //No top center label
8489
8490
8491                //Do right side labels
8492                x = 1;//on right
8493                centered = true;
8494                if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
8495                {
8496                    y = 0;//center
8497                    centered = true;//vertically centered, only matters for labels on left and right side
8498                    temp = modifiers.get(Modifiers.X_ALTITUDE_DEPTH);
8499                    if(temp != null && !temp.isEmpty())
8500                        mods.add(new Modifier("X", temp, x, y, centered));
8501                }
8502                else if(!strict)
8503                {
8504                    //if no "H', bring G and M closer to the center
8505                    centered = false;
8506                }
8507
8508                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
8509                {
8510                    y = 1;//center
8511                    temp = modifiers.get(Modifiers.V_EQUIP_TYPE);
8512                    if(temp != null && !temp.isEmpty())
8513                        mods.add(new Modifier("V", temp, x, y, centered));
8514                }
8515
8516                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1) || modifiers.containsKey(Modifiers.AS_COUNTRY))
8517                {
8518                    y = 2;
8519                    if(!strict && !modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
8520                        y--;
8521                    temp = "";
8522                    if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
8523                        temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1) + sep;
8524                    if(modifiers.containsKey(Modifiers.AS_COUNTRY))
8525                        temp += modifiers.get(Modifiers.AS_COUNTRY);
8526                    temp = temp.trim();
8527
8528                    if(temp != null && !temp.isEmpty())
8529                        mods.add(new Modifier("T AS", temp, x, y, centered));
8530                }
8531
8532                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS)  ||
8533                        modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
8534                {
8535                    y = -1;//below center
8536
8537                    temp = "";
8538                    if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
8539                        temp = modifiers.get(Modifiers.G_STAFF_COMMENTS) + sep;
8540                    if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
8541                        temp += modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
8542                    temp = temp.trim();
8543
8544                    if(temp != null && !temp.isEmpty())
8545                        mods.add(new Modifier("G H", temp, x, y, centered));
8546                }
8547
8548                if(modifiers.containsKey(Modifiers.Y_LOCATION) ||
8549                        modifiers.containsKey(Modifiers.Z_SPEED))
8550                {
8551                    y = -2;
8552                    if(!strict)
8553                    {
8554                        if(!(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS)  ||
8555                                modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1)))
8556                            y++;
8557                    }
8558                    temp = "";
8559                    if(modifiers.containsKey(Modifiers.Y_LOCATION))
8560                        temp = modifiers.get(Modifiers.Y_LOCATION) + sep;
8561                    if(modifiers.containsKey(Modifiers.Z_SPEED))
8562                        temp += modifiers.get(Modifiers.Z_SPEED);
8563                    temp = temp.trim();
8564                    if(temp != null && !temp.isEmpty())
8565                        mods.add(new Modifier("Y Z", temp, x, y, centered));
8566                }
8567
8568                //No left side labels
8569                x = -1;
8570                centered = false;
8571
8572                if(modifiers.containsKey(Modifiers.AR_SPECIAL_DESIGNATOR))
8573                {
8574                    y = 2;
8575                    if(!strict && !modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
8576                    {
8577                        y--;
8578                    }
8579                    temp = modifiers.get(Modifiers.AR_SPECIAL_DESIGNATOR);
8580                    temp = temp.trim();
8581                    if(temp != null && !temp.isEmpty())
8582                        mods.add(new Modifier("AR", temp, x, y, centered));
8583                }
8584            }
8585            else if(ss == SymbolID.SymbolSet_DismountedIndividuals)
8586            {
8587                //Do bottom center label
8588                x = 0;//centered
8589                y = -9;//on bottom of symbol
8590                if(modifiers.containsKey(Modifiers.C_QUANTITY))
8591                {
8592                    temp = modifiers.get(Modifiers.C_QUANTITY);
8593                    if(temp != null && !temp.isEmpty())
8594                        mods.add(new Modifier("C", temp, x, y, centered));
8595                }
8596
8597                //Do right side labels
8598                x = 1;//on right
8599                if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
8600                {
8601                    y = 0;//center
8602                    centered = true;//vertically centered, only matters for labels on left and right side
8603                    temp = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
8604
8605                    if(temp != null && !temp.isEmpty())
8606                        mods.add(new Modifier("H", temp, x, y, centered));
8607                }
8608                else if(!strict)
8609                {
8610                    centered = false;
8611                }
8612
8613                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
8614                {
8615                    y = 1;//above center
8616                    temp = modifiers.get(Modifiers.G_STAFF_COMMENTS);
8617
8618                    if(temp != null && !temp.isEmpty())
8619                        mods.add(new Modifier("G", temp, x, y, centered));
8620                }
8621
8622                if(modifiers.containsKey(Modifiers.AS_COUNTRY))
8623                {
8624                    y = 2;
8625                    if(!strict && !(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS)))
8626                        y--;
8627                    temp = modifiers.get(Modifiers.AS_COUNTRY);
8628
8629                    if(temp != null && !temp.isEmpty())
8630                        mods.add(new Modifier("AS", temp, x, y, centered));
8631                }
8632
8633                if(modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
8634                {
8635                    y = -1;//below center
8636                    temp = modifiers.get(Modifiers.M_HIGHER_FORMATION);
8637                    if(temp != null && !temp.isEmpty())
8638                        mods.add(new Modifier("M", temp, x, y, centered));
8639                }
8640
8641                if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING) ||
8642                        modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS) ||
8643                        modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
8644                {
8645                    y = -2;
8646                    if(!strict && !modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
8647                        y++;
8648                    temp = "";
8649                    if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING))
8650                        temp = modifiers.get(Modifiers.J_EVALUATION_RATING) + sep;
8651                    if(modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS))
8652                        temp += modifiers.get(Modifiers.K_COMBAT_EFFECTIVENESS) + sep;
8653                    if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
8654                        temp += modifiers.get(Modifiers.P_IFF_SIF_AIS);
8655                    temp = temp.trim();
8656                    if(temp != null && !temp.isEmpty())
8657                        mods.add(new Modifier("J K P", temp, x, y, centered));
8658                }
8659
8660                //Do left side labels
8661                x = -1;//on left
8662
8663                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE) ||
8664                        modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
8665                {
8666                    y = 0;//center
8667                    centered = true;//vertically centered, only matters for labels on left and right side
8668
8669                    temp = "";
8670                    if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
8671                        temp = modifiers.get(Modifiers.V_EQUIP_TYPE) + sep;
8672                    if(modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
8673                        temp += modifiers.get(Modifiers.AF_COMMON_IDENTIFIER);
8674                    temp = temp.trim();
8675                    if(temp != null && !temp.isEmpty())
8676                        mods.add(new Modifier("V AF", temp, x, y, centered));
8677                }
8678                else if(!strict)
8679                {
8680                    centered = false;
8681                }
8682
8683                if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION))
8684                {
8685                    y = 1;
8686                    temp = "";
8687                    if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
8688                        temp = modifiers.get(Modifiers.X_ALTITUDE_DEPTH) + sep;
8689                    if(modifiers.containsKey(Modifiers.Y_LOCATION))
8690                        temp += modifiers.get(Modifiers.Y_LOCATION);
8691
8692                    temp = temp.trim();
8693                    mods.add(new Modifier("X Y", temp, x, y, centered));
8694                }
8695
8696                if(modifiers.containsKey(Modifiers.W_DTG_1))
8697                {
8698                    y = 2;//above center
8699                    if(!strict && !(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION)))
8700                        y--;
8701
8702                    temp = modifiers.get(Modifiers.W_DTG_1);
8703
8704                    if(temp != null && !temp.isEmpty())
8705                        mods.add(new Modifier("W", temp, x, y, centered));
8706                }
8707
8708                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
8709                {
8710                    y = -1;//below center
8711                    temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
8712
8713                    if(temp != null && !temp.isEmpty())
8714                        mods.add(new Modifier("T", temp, x, y, centered));
8715                }
8716
8717                if(modifiers.containsKey(Modifiers.Z_SPEED))
8718                {
8719                    y = -2;
8720                    if(!strict && !(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)))
8721                        y++;
8722                    temp = modifiers.get(Modifiers.Z_SPEED);
8723                    if(temp != null && !temp.isEmpty())
8724                        mods.add(new Modifier("Z", temp, x, y, centered));
8725                }
8726            }
8727            else if(ss == SymbolID.SymbolSet_Activities)
8728            {
8729                //No top center label
8730
8731                //Do right side labels
8732                x = 1;//on right
8733                centered = false;
8734
8735                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
8736                {
8737                    y = 1;
8738
8739                    temp = modifiers.get(Modifiers.G_STAFF_COMMENTS);
8740                    if(temp != null && !temp.isEmpty())
8741                        mods.add(new Modifier("G", temp, x, y, centered));
8742                }
8743
8744                if(modifiers.containsKey(Modifiers.AS_COUNTRY))
8745                {
8746                    y = 2;
8747                    if(!strict && !modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
8748                        y--;
8749                    temp = modifiers.get(Modifiers.AS_COUNTRY);
8750
8751                    if(temp != null && !temp.isEmpty())
8752                        mods.add(new Modifier("AS", temp, x, y, centered));
8753                }
8754
8755                if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
8756                {
8757                    y = -1;//below center
8758                    temp = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1);
8759                    if(temp != null && !temp.isEmpty())
8760                        mods.add(new Modifier("H", temp, x, y, centered));
8761                }
8762
8763                if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING))
8764                {
8765                    y = -2;
8766                    if(!strict && !modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
8767                        y++;
8768                    temp = temp = modifiers.get(Modifiers.J_EVALUATION_RATING);
8769
8770                    if(temp != null && !temp.isEmpty())
8771                        mods.add(new Modifier("J", temp, x, y, centered));
8772                }
8773
8774                //Do left side labels
8775                x = -1;//on left
8776                centered = false;
8777                if(ver == SymbolID.Version_APP6Ech2 && modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
8778                {
8779                    centered = true;
8780                    y = 0;//below center
8781                    temp = modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
8782                    if(temp != null && !temp.isEmpty())
8783                        mods.add(new Modifier("T", temp, x, y, centered));
8784                }
8785
8786                if(modifiers.containsKey(Modifiers.Y_LOCATION))
8787                {
8788                    y = 1;
8789                    temp = modifiers.get(Modifiers.Y_LOCATION);
8790
8791                    if(temp != null && !temp.isEmpty())
8792                        mods.add(new Modifier("Y", temp, x, y, centered));
8793                }
8794
8795                if(modifiers.containsKey(Modifiers.W_DTG_1))
8796                {
8797                    y = 2;//above center
8798                    if(!strict && !modifiers.containsKey(Modifiers.Y_LOCATION))
8799                        y--;
8800                    temp = modifiers.get(Modifiers.W_DTG_1);
8801                    if(temp != null && !temp.isEmpty())
8802                        mods.add(new Modifier("W", temp, x, y, centered));
8803                }
8804
8805            }
8806            else if(ss == SymbolID.SymbolSet_CyberSpace)//APP6Ev2 only
8807            {
8808                //Only Command & Control has AA; ec.equals("110000").  Always in the middle of the unit.
8809                if(modifiers.containsKey(Modifiers.AA_SPECIAL_C2_HQ))
8810                {
8811                    temp = modifiers.get(Modifiers.AA_SPECIAL_C2_HQ);
8812                    if(temp != null && !temp.isEmpty())
8813                        mods.add(new Modifier("AA", temp, 0, 0, true));
8814                }
8815
8816                //Do top center label
8817                x = 0;//centered
8818                y = 9;//on top of symbol
8819                if(modifiers.containsKey(Modifiers.B_ECHELON))
8820                {
8821                    temp = modifiers.get(Modifiers.B_ECHELON);
8822                    if(temp != null && !temp.isEmpty())
8823                        mods.add(new Modifier("B", temp, x, y, centered));
8824                }
8825
8826
8827                x = 0;//centered
8828                y = -9;//on bottom of symbol
8829                if(ver == SymbolID.Version_APP6Ech2 &&
8830                        (modifiers.containsKey(Modifiers.AW_HEADQUARTERS_ELEMENT)))
8831                {
8832                    temp = modifiers.get(Modifiers.AW_HEADQUARTERS_ELEMENT);
8833                    if(temp != null && !temp.isEmpty())
8834                        mods.add(new Modifier("AW", temp, x, y, centered));
8835                }
8836
8837                //Do right side labels
8838                x = 1;//on right
8839                if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1) ||
8840                        modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
8841                {
8842                    y = 0;//center
8843                    centered = true;//vertically centered, only matters for labels on left and right side
8844                    temp = "";
8845                    if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
8846                        temp = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1) + sep;
8847                    if(modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
8848                        temp += modifiers.get(Modifiers.AF_COMMON_IDENTIFIER);
8849                    temp = temp.trim();
8850                    if(temp != null && !temp.isEmpty())
8851                        mods.add(new Modifier("H AF", temp, x, y, centered));
8852                }
8853                else if(!strict)
8854                {
8855                    //if no "H', bring G and M closer to the center
8856                    centered = false;
8857                }
8858
8859                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) || modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT))
8860                {
8861                    y = 1;//above center
8862                    temp = "";
8863                    if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
8864                        temp = modifiers.get(Modifiers.G_STAFF_COMMENTS) + sep;
8865                    if(modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT))
8866                        temp += modifiers.get(Modifiers.AQ_GUARDED_UNIT);
8867                    temp = temp.trim();
8868                    if(temp != null && !temp.isEmpty())
8869                        mods.add(new Modifier("G AQ", temp, x, y, centered));
8870                }
8871
8872                if(modifiers.containsKey(Modifiers.F_REINFORCED_REDUCED) || modifiers.containsKey(Modifiers.AS_COUNTRY))
8873                {
8874                    y = 2;
8875                    if(!strict && !(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) || modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT)))
8876                        y--;
8877                    temp = "";
8878                    if(modifiers.containsKey(Modifiers.F_REINFORCED_REDUCED))
8879                        temp = modifiers.get(Modifiers.F_REINFORCED_REDUCED) + sep;
8880                    if(modifiers.containsKey(Modifiers.AS_COUNTRY))
8881                        temp += modifiers.get(Modifiers.AS_COUNTRY);
8882                    temp = temp.trim();
8883                    if(temp != null && !temp.isEmpty())
8884                        mods.add(new Modifier("F AS", temp, x, y, centered));
8885                }
8886
8887                if(modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
8888                {
8889                    y = -1;//below center
8890                    temp = modifiers.get(Modifiers.M_HIGHER_FORMATION);
8891                    if(temp != null && !temp.isEmpty())
8892                        mods.add(new Modifier("M", temp, x, y, centered));
8893                }
8894
8895                if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING) ||
8896                        modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS) ||
8897                        modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP) ||
8898                        modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
8899                {
8900                    y = -2;
8901                    if(!strict && !modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
8902                        y++;
8903                    temp = "";
8904                    if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING))
8905                        temp = modifiers.get(Modifiers.J_EVALUATION_RATING) + sep;
8906                    if(modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS))
8907                        temp += modifiers.get(Modifiers.K_COMBAT_EFFECTIVENESS) + sep;
8908                    if(modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP))
8909                        temp += modifiers.get(Modifiers.L_SIGNATURE_EQUIP) + sep;
8910                    if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
8911                        temp += modifiers.get(Modifiers.P_IFF_SIF_AIS);
8912                    temp = temp.trim();
8913                    if(temp != null && !temp.isEmpty())
8914                        mods.add(new Modifier("J K L P", temp, x, y, centered));
8915                }
8916
8917                //Do left side labels
8918                x = -1;//on left
8919
8920                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE) ||
8921                        modifiers.containsKey(Modifiers.AD_PLATFORM_TYPE) ||
8922                        modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME))
8923                {
8924                    y = 0;//center
8925                    centered = true;//vertically centered, only matters for labels on left and right side
8926
8927                    temp = "";
8928                    if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
8929                        temp = modifiers.get(Modifiers.V_EQUIP_TYPE) + sep;
8930                    if(modifiers.containsKey(Modifiers.AD_PLATFORM_TYPE))
8931                        temp += modifiers.get(Modifiers.AD_PLATFORM_TYPE) + sep;
8932                    if(modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME))
8933                        temp += modifiers.get(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME);
8934                    temp = temp.trim();
8935                    if(temp != null && !temp.isEmpty())
8936                        mods.add(new Modifier("V AD AE", temp, x, y, centered));
8937                }
8938                else if(!strict)
8939                {
8940                    centered = false;
8941                }
8942
8943                if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION))
8944                {
8945                    y = 1;
8946                    temp = "";
8947                    if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
8948                        temp = modifiers.get(Modifiers.X_ALTITUDE_DEPTH) + sep;
8949                    if(modifiers.containsKey(Modifiers.Y_LOCATION))
8950                        temp += modifiers.get(Modifiers.Y_LOCATION);
8951
8952                    temp = temp.trim();
8953                    mods.add(new Modifier("X Y", temp, x, y, centered));
8954                }
8955
8956                if(modifiers.containsKey(Modifiers.W_DTG_1))
8957                {
8958                    y = 2;//above center
8959                    if(!strict && !(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION)))
8960                        y--;
8961
8962                    temp = modifiers.get(Modifiers.W_DTG_1);
8963
8964                    if(temp != null && !temp.isEmpty())
8965                        mods.add(new Modifier("W", temp, x, y, centered));
8966                }
8967
8968                if(modifiers.containsKey(Modifiers.C_QUANTITY) || modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
8969                {
8970                    y = -1;//below center
8971                    temp = "";
8972                    if(modifiers.containsKey(Modifiers.C_QUANTITY))
8973                        temp = modifiers.get(Modifiers.C_QUANTITY) + sep;
8974                    if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
8975                        temp += modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
8976
8977                    temp = temp.trim();
8978                    if(temp != null && !temp.isEmpty())
8979                        mods.add(new Modifier("C T", temp, x, y, centered));
8980                }
8981
8982                if(modifiers.containsKey(Modifiers.AY_NETWORK_IDENTIFIER))
8983                {
8984                    y = -2;
8985                    if(!strict && !(modifiers.containsKey(Modifiers.C_QUANTITY) || modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)))
8986                        y++;
8987                    temp = modifiers.get(Modifiers.AY_NETWORK_IDENTIFIER);
8988                    if(temp != null && !temp.isEmpty())
8989                        mods.add(new Modifier("AY", temp, x, y, centered));
8990                }
8991            }
8992            else if(ss == SymbolID.SymbolSet_CyberSpace_Equipment)//APP6Ev2 only
8993            {
8994                //Only Command & Control has AA; ec.equals("110000").  Always in the middle of the unit.
8995                if(modifiers.containsKey(Modifiers.AA_SPECIAL_C2_HQ))
8996                {
8997                    temp = modifiers.get(Modifiers.AA_SPECIAL_C2_HQ);
8998                    if(temp != null && !temp.isEmpty())
8999                        mods.add(new Modifier("AA", temp, 0, 0, true));
9000                }
9001
9002                //Do top center label
9003                x = 0;//centered
9004                y = 9;//on top of symbol
9005                if(modifiers.containsKey(Modifiers.C_QUANTITY))
9006                {
9007                    temp = modifiers.get(Modifiers.C_QUANTITY);
9008                    if(temp != null && !temp.isEmpty())
9009                        mods.add(new Modifier("C", temp, x, y, centered));
9010                }
9011
9012
9013                x = 0;//centered
9014                y = -9;//on bottom of symbol
9015                if(ver == SymbolID.Version_APP6Ech2 &&
9016                        (modifiers.containsKey(Modifiers.AW_HEADQUARTERS_ELEMENT)))
9017                {
9018                    temp = modifiers.get(Modifiers.AW_HEADQUARTERS_ELEMENT);
9019                    if(temp != null && !temp.isEmpty())
9020                        mods.add(new Modifier("AW", temp, x, y, centered));
9021                }
9022
9023                //Do right side labels
9024                x = 1;//on right
9025                if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1) ||
9026                        modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
9027                {
9028                    y = 0;//center
9029                    centered = true;//vertically centered, only matters for labels on left and right side
9030                    temp = "";
9031                    if(modifiers.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
9032                        temp = modifiers.get(Modifiers.H_ADDITIONAL_INFO_1) + sep;
9033                    if(modifiers.containsKey(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME))
9034                        temp += modifiers.get(Modifiers.AE_EQUIPMENT_TEARDOWN_TIME);
9035                    temp = temp.trim();
9036                    if(temp != null && !temp.isEmpty())
9037                        mods.add(new Modifier("H AE", temp, x, y, centered));
9038                }
9039                else if(!strict)
9040                {
9041                    //if no "H', bring G and M closer to the center
9042                    centered = false;
9043                }
9044
9045                if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
9046                {
9047                    y = 1;//above center
9048                    temp = "";
9049                    if(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS))
9050                        temp = modifiers.get(Modifiers.G_STAFF_COMMENTS);
9051                    temp = temp.trim();
9052                    if(temp != null && !temp.isEmpty())
9053                        mods.add(new Modifier("G", temp, x, y, centered));
9054                }
9055
9056                if(modifiers.containsKey(Modifiers.F_REINFORCED_REDUCED) || modifiers.containsKey(Modifiers.AS_COUNTRY))
9057                {
9058                    y = 2;
9059                    if(!strict && !(modifiers.containsKey(Modifiers.G_STAFF_COMMENTS) || modifiers.containsKey(Modifiers.AQ_GUARDED_UNIT)))
9060                        y--;
9061                    temp = "";
9062                    if(modifiers.containsKey(Modifiers.F_REINFORCED_REDUCED))
9063                        temp = modifiers.get(Modifiers.F_REINFORCED_REDUCED) + sep;
9064                    if(modifiers.containsKey(Modifiers.AS_COUNTRY))
9065                        temp += modifiers.get(Modifiers.AS_COUNTRY);
9066                    temp = temp.trim();
9067                    if(temp != null && !temp.isEmpty())
9068                        mods.add(new Modifier("F AS", temp, x, y, centered));
9069                }
9070
9071                if(modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
9072                {
9073                    y = -1;//below center
9074                    temp = modifiers.get(Modifiers.M_HIGHER_FORMATION);
9075                    if(temp != null && !temp.isEmpty())
9076                        mods.add(new Modifier("M", temp, x, y, centered));
9077                }
9078
9079                if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING) ||
9080                        modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS) ||
9081                        modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP) ||
9082                        modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
9083                {
9084                    y = -2;
9085                    if(!strict && !modifiers.containsKey(Modifiers.M_HIGHER_FORMATION))
9086                        y++;
9087                    temp = "";
9088                    if(modifiers.containsKey(Modifiers.J_EVALUATION_RATING))
9089                        temp = modifiers.get(Modifiers.J_EVALUATION_RATING) + sep;
9090                    if(modifiers.containsKey(Modifiers.K_COMBAT_EFFECTIVENESS))
9091                        temp += modifiers.get(Modifiers.K_COMBAT_EFFECTIVENESS) + sep;
9092                    if(modifiers.containsKey(Modifiers.L_SIGNATURE_EQUIP))
9093                        temp += modifiers.get(Modifiers.L_SIGNATURE_EQUIP) + sep;
9094                    if(modifiers.containsKey(Modifiers.N_HOSTILE))
9095                        temp += modifiers.get(Modifiers.N_HOSTILE) + sep;
9096                    if(modifiers.containsKey(Modifiers.P_IFF_SIF_AIS))
9097                        temp += modifiers.get(Modifiers.P_IFF_SIF_AIS);
9098                    temp = temp.trim();
9099                    if(temp != null && !temp.isEmpty())
9100                        mods.add(new Modifier("J K L N P", temp, x, y, centered));
9101                }
9102
9103                //Do left side labels
9104                x = -1;//on left
9105
9106                if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE) ||
9107                        modifiers.containsKey(Modifiers.AD_PLATFORM_TYPE) ||
9108                        modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
9109                {
9110                    y = 0;//center
9111                    centered = true;//vertically centered, only matters for labels on left and right side
9112
9113                    temp = "";
9114                    if(modifiers.containsKey(Modifiers.V_EQUIP_TYPE))
9115                        temp = modifiers.get(Modifiers.V_EQUIP_TYPE) + sep;
9116                    if(modifiers.containsKey(Modifiers.AD_PLATFORM_TYPE))
9117                        temp += modifiers.get(Modifiers.AD_PLATFORM_TYPE) + sep;
9118                    if(modifiers.containsKey(Modifiers.AF_COMMON_IDENTIFIER))
9119                        temp += modifiers.get(Modifiers.AF_COMMON_IDENTIFIER);
9120                    temp = temp.trim();
9121                    if(temp != null && !temp.isEmpty())
9122                        mods.add(new Modifier("V AD AF", temp, x, y, centered));
9123                }
9124                else if(!strict)
9125                {
9126                    centered = false;
9127                }
9128
9129                if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION))
9130                {
9131                    y = 1;
9132                    temp = "";
9133                    if(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH))
9134                        temp = modifiers.get(Modifiers.X_ALTITUDE_DEPTH) + sep;
9135                    if(modifiers.containsKey(Modifiers.Y_LOCATION))
9136                        temp += modifiers.get(Modifiers.Y_LOCATION);
9137
9138                    temp = temp.trim();
9139                    mods.add(new Modifier("X Y", temp, x, y, centered));
9140                }
9141
9142                if(modifiers.containsKey(Modifiers.W_DTG_1))
9143                {
9144                    y = 2;//above center
9145                    if(!strict && !(modifiers.containsKey(Modifiers.X_ALTITUDE_DEPTH) || modifiers.containsKey(Modifiers.Y_LOCATION)))
9146                        y--;
9147
9148                    temp = modifiers.get(Modifiers.W_DTG_1);
9149
9150                    if(temp != null && !temp.isEmpty())
9151                        mods.add(new Modifier("W", temp, x, y, centered));
9152                }
9153
9154                if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
9155                {
9156                    y = -1;//below center
9157                    temp = "";
9158                    if(modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
9159                        temp += modifiers.get(Modifiers.T_UNIQUE_DESIGNATION_1);
9160
9161                    temp = temp.trim();
9162                    if(temp != null && !temp.isEmpty())
9163                        mods.add(new Modifier("T", temp, x, y, centered));
9164                }
9165
9166                if(modifiers.containsKey(Modifiers.AY_NETWORK_IDENTIFIER))
9167                {
9168                    y = -2;
9169                    if(!strict && !(modifiers.containsKey(Modifiers.C_QUANTITY) || modifiers.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1)))
9170                        y++;
9171                    temp = modifiers.get(Modifiers.AY_NETWORK_IDENTIFIER);
9172                    if(temp != null && !temp.isEmpty())
9173                        mods.add(new Modifier("AY", temp, x, y, centered));
9174                }
9175            }
9176            /*else if(ver == SymbolID.SymbolSet_MineWarfare)
9177            {
9178                //no modifiers
9179            }//*/
9180            //else//SymbolSet Unknown
9181            //processUnknownTextModifiers
9182        }
9183
9184        return mods;
9185    }
9186
9187
9188    /**
9189     * @param bounds     bounds of the core icon
9190     * @param labelWidth height of the label to be placed
9191     * @param location   -1 left, 0 center, 1 right
9192     * @returns
9193     */
9194    private static double getLabelXPosition(Rect bounds, int labelWidth, int location, float modifierFontHeight)
9195    {
9196        int buffer = (int)modifierFontHeight/2;
9197
9198        double x = 0;
9199        if(location == 1)//on right
9200        {
9201            x = bounds.left + bounds.width() + buffer;
9202        }
9203        else if(location == -1)//left
9204        {
9205            x = bounds.left - labelWidth - buffer;
9206        }
9207        else if(location == 0)
9208        {
9209            x = Math.round((bounds.left + (bounds.width() * 0.5f)) - (labelWidth * 0.5f));
9210        }
9211        return x;
9212    }
9213
9214    /**
9215     *
9216     * @param bounds bounds of the core icon
9217     * @param labelHeight height of the label to be placed
9218     * @param descent descent of the label to be placed
9219     * @param bufferText spacing buffer if desired
9220     * @param centered if true, there will be a center label location identified by 0
9221     * @param location positive 1, 2, 3 to be above symbol mid-point or negative values to be below
9222     * @returns y position
9223     */
9224    private static double getLabelYPosition(Rect bounds, int labelHeight, int descent, int bufferText, boolean centered, int location) {
9225        double y = 0;
9226        if (bounds != null && !bounds.isEmpty())
9227        {
9228            if(centered)
9229            {
9230                switch (location)
9231                {
9232                    case 3://3 above center
9233                        y = (bounds.height());
9234                        y = ((y * 0.5) + (labelHeight * 0.5));
9235                        y = y - ((labelHeight + bufferText) * 3);
9236                        y = bounds.top + y;
9237                        break;
9238                    case 2://2 above center
9239                        y = (bounds.height());
9240                        y = ((y * 0.5) + (labelHeight * 0.5));
9241                        y = y - ((labelHeight + bufferText) * 2);
9242                        y = bounds.top + y;
9243                        break;
9244                    case 1://1 above center
9245                        y = (bounds.height());
9246                        y = ((y * 0.5) + (labelHeight * 0.5));
9247                        y = y - ((labelHeight + bufferText));
9248                        y = bounds.top + y;
9249                        break;
9250                    case 0: //centered
9251                        y = (bounds.height());
9252                        y = ((y * 0.5) + ((labelHeight - descent) * 0.5));
9253                        y = bounds.top + y;
9254                        break;
9255                    case -1://1 below center
9256                        y = (bounds.height());
9257                        y = ((y * 0.5) + (labelHeight * 0.5));
9258                        y = y + ((labelHeight + bufferText - descent));
9259                        y = bounds.top + y;
9260                        break;
9261                    case -2://2 below center
9262                        y = (bounds.height());
9263                        y = ((y * 0.5) + (labelHeight * 0.5));
9264                        y = y + ((labelHeight + bufferText) * 2) - (descent);
9265                        y = bounds.top + y;
9266                        break;
9267                    case -3://3 below center
9268                        y = (bounds.height());
9269                        y = ((y * 0.5) + (labelHeight * 0.5));
9270                        y = y + ((labelHeight + bufferText) * 3) - (descent);
9271                        y = bounds.top + y;
9272                        break;
9273                }
9274            }
9275            else//split between top and bottom
9276            {
9277                switch (location)
9278                {
9279                    case 3:
9280                        y = (bounds.top + ((bounds.height() / 2) - descent - labelHeight*2 - bufferText));
9281                        break;
9282                    case 2:
9283                        y = (bounds.top + ((bounds.height() / 2) - descent - labelHeight - bufferText));
9284                        break;
9285                    case 1:
9286                        y = (bounds.top + ((bounds.height() / 2) - descent));
9287                        break;
9288                    case -1:
9289                        y = (bounds.top + (bounds.height() / 2) + (labelHeight - descent + bufferText));
9290                        break;
9291                    case -2:
9292                        y = (bounds.top + (bounds.height() / 2) + ((labelHeight*2 - descent + bufferText)));
9293                        break;
9294                    case -3:
9295                        y = (bounds.top + (bounds.height() / 2) + ((labelHeight*3 - descent + bufferText)));
9296                        break;
9297                }
9298            }
9299            if(location == 9)//on top of symbol
9300            {
9301                y = Math.round(bounds.top - bufferText - descent);
9302            }
9303            if(location == -9)//on bottom of symbol
9304            {
9305                y = (int)Math.round(bounds.top + bounds.height() + bufferText + labelHeight - descent);
9306            }
9307        }
9308        return y;
9309    }
9310
9311    /**
9312     * Currently, modifiers are based on Symbol Set.
9313     * The exception is SIGINT which required a frame shape value in 2525E+
9314     * The SSMC couldn't come to an agreement on if frame shape should dictate modifiers.
9315     * Currently, I'm keeping it tied to Symbol Set.
9316     * @param symbolID
9317     * @return
9318     */
9319    private static boolean isCOnTop(String symbolID)
9320    {
9321        boolean onTop = false;
9322
9323        int version = SymbolID.getVersion(symbolID);
9324        int ss = SymbolID.getSymbolSet(symbolID);
9325        char frame = SymbolID.getFrameShape(symbolID);
9326
9327        if(SymbolUtilities.hasModifier(symbolID,Modifiers.C_QUANTITY)) {
9328
9329            if(version >= SymbolID.Version_2525E)
9330            {
9331
9332                if (ss == SymbolID.SymbolSet_Air ||
9333                        ss == SymbolID.SymbolSet_AirMissile ||
9334                        ss == SymbolID.SymbolSet_Space ||
9335                        ss == SymbolID.SymbolSet_SpaceMissile ||
9336                        ss == SymbolID.SymbolSet_LandEquipment)
9337                {
9338                    onTop = true;
9339                }
9340                else if(ss == SymbolID.SymbolSet_SignalsIntelligence &&
9341                        (frame == SymbolID.FrameShape_Air ||
9342                        frame == SymbolID.FrameShape_Space ||
9343                        frame == SymbolID.FrameShape_LandEquipment || frame == SymbolID.FrameShape_LandUnit || frame == '0'))
9344                {
9345                    onTop = true;
9346                }
9347
9348            }// else if <= SymbolID.Version_2525Dch1
9349            else if (ss == SymbolID.SymbolSet_LandEquipment ||
9350                    ss == SymbolID.SymbolSet_SignalsIntelligence_Land)
9351            {
9352                onTop = true;
9353            }
9354        }
9355        return onTop;
9356    }
9357    public static boolean hasDisplayModifiers(String symbolID, Map<String,String> modifiers)
9358    {
9359        boolean hasModifiers = false;
9360        int ss = SymbolID.getSymbolSet(symbolID);
9361        int status = SymbolID.getStatus(symbolID);
9362        int context = SymbolID.getContext(symbolID);
9363
9364        if(ss == SymbolID.SymbolSet_ControlMeasure)//check control measure
9365        {
9366            if (SymbolUtilities.isCBRNEvent(symbolID) == true && modifiers.containsKey(Modifiers.Q_DIRECTION_OF_MOVEMENT))
9367            {
9368                hasModifiers = true;
9369            }
9370            else if(SymbolUtilities.hasFDI(symbolID))
9371                hasModifiers = true;
9372        }
9373        else if(ss != SymbolID.SymbolSet_Atmospheric &&
9374                ss != SymbolID.SymbolSet_Oceanographic &&
9375                ss != SymbolID.SymbolSet_MeteorologicalSpace)
9376        {//checking units
9377
9378            if(context > 0) //Exercise or Simulation
9379                hasModifiers = true;
9380
9381            //echelon or mobility,
9382            if (SymbolID.getAmplifierDescriptor(symbolID) > 0 || modifiers.containsKey(Modifiers.Q_DIRECTION_OF_MOVEMENT))
9383                hasModifiers = true;
9384
9385            if(modifiers.containsKey(Modifiers.AJ_SPEED_LEADER))
9386                hasModifiers = true;
9387
9388            if(modifiers.containsKey(Modifiers.AO_ENGAGEMENT_BAR))
9389                hasModifiers = true;
9390
9391            //HQ/Taskforce
9392            if(SymbolID.getHQTFD(symbolID) > 0)
9393                hasModifiers = true;
9394
9395            if(status > 1)//Fully capable, damaged, destroyed
9396                hasModifiers = true;
9397        }//no display modifiers for single point weather
9398
9399
9400
9401        return hasModifiers;
9402    }
9403
9404    public static boolean hasTextModifiers(String symbolID, Map<String,String> modifiers)
9405    {
9406
9407        int ss = SymbolID.getSymbolSet(symbolID);
9408        int ec = SymbolID.getEntityCode(symbolID);
9409        if(ss == SymbolID.SymbolSet_Atmospheric)
9410        {
9411            switch(ec)
9412            {
9413                case 110102: //tropopause low
9414                case 110202: //tropopause high
9415                case 162200: //tropopause level ?
9416                case 162300: //freezing level ?
9417                    return true;
9418                default:
9419                        return false;
9420            }
9421        }
9422        else if(ss == SymbolID.SymbolSet_Oceanographic || ss == SymbolID.SymbolSet_MeteorologicalSpace)
9423        {
9424            return false;
9425        }
9426        else if (ss == SymbolID.SymbolSet_ControlMeasure)
9427        {
9428            MSInfo msi = MSLookup.getInstance().getMSLInfo(symbolID);
9429
9430            if( msi.getModifiers().size() > 0 && modifiers != null && modifiers.size() > 0)
9431                return true;
9432            else
9433                return false;
9434        }
9435        else
9436        {
9437
9438            if (SymbolUtilities.getStandardIdentityModifier(symbolID) != null)
9439            {
9440                return true;
9441            }
9442
9443            int cc = SymbolID.getCountryCode(symbolID);
9444            if (cc > 0 && !GENCLookup.getInstance().get3CharCode(cc).isEmpty())
9445            {
9446                return true;
9447            }//*/
9448
9449            else if (modifiers.size() > 0)
9450            {
9451                return true;
9452            }
9453        }
9454        return false;
9455    }
9456
9457    /**
9458     * Rerturns either the default font from RendererSettings or font based on properties
9459     * set in MilStdAttributes.
9460     * @param attributes
9461     * @return
9462     */
9463    private static Paint getFont(Map<String,String> attributes)
9464    {
9465        Paint p = null;
9466        Typeface tf = null;
9467
9468        p = RendererSettings.getInstance().getModiferFont();
9469
9470        String[] props = RendererSettings.getInstance().getModiferFontProps();
9471
9472        String ff = props[0];
9473        int fstyle = Integer.parseInt(props[1]);// modifierFont.getTypeface().getStyle();
9474        float fsize = Float.parseFloat(props[2]);// modifierFont.getTextSize();
9475        String temp = null;
9476
9477
9478        if(attributes.containsKey(MilStdAttributes.FontFamily) ||
9479                attributes.containsKey(MilStdAttributes.FontStyle) ||
9480                attributes.containsKey(MilStdAttributes.FontSize))
9481        {
9482            if(attributes.containsKey(MilStdAttributes.FontStyle))
9483            {
9484                temp = attributes.get(MilStdAttributes.FontStyle);
9485                if (temp != null && !temp.isEmpty()) {
9486                    fstyle = Integer.parseInt(temp);
9487                }
9488            }
9489            if(attributes.containsKey(MilStdAttributes.FontSize))
9490            {
9491                temp = attributes.get(MilStdAttributes.FontSize);
9492                if (temp != null && !temp.isEmpty()) {
9493                    fsize = Float.parseFloat(temp);
9494                }
9495            }
9496            if(attributes.containsKey(MilStdAttributes.FontFamily))
9497            {
9498                temp = attributes.get(MilStdAttributes.FontFamily);
9499                if (temp != null && !temp.isEmpty()) {
9500                    ff =  temp;//Typeface.create(temp,fstyle);
9501                }
9502            }
9503            tf = Typeface.create(ff,fstyle);
9504            if(tf == null)
9505                tf = Typeface.create(props[0],fstyle);
9506            if(tf == null)
9507                return null;
9508
9509            p = new Paint();
9510            p.setTextSize(fsize);
9511            p.setAntiAlias(true);
9512            p.setTypeface(tf);
9513            p.setStrokeCap(Cap.BUTT);
9514            p.setStrokeJoin(Join.MITER);
9515            p.setStrokeMiter(3f);
9516
9517            return p;
9518        }
9519        else
9520            return _modifierFont;
9521
9522    }
9523
9524    private static float[] getFontHeightandDescent(Paint font)
9525    {
9526        float[] hd = {0f,0f};
9527
9528        if(font != null) {
9529            Paint.FontMetrics fm = font.getFontMetrics();
9530            //_modifierFontHeight = fm.top + fm.bottom;
9531            hd[0] = fm.bottom - fm.top;
9532            hd[1] = fm.descent;
9533        }
9534        return hd;
9535    }
9536
9537}