001/*
002 * To change this template, choose Tools | Templates
003 * and open the template in the editor.
004 */
005package armyc2.c5isr.renderer.utilities;
006
007import java.util.ArrayList;
008import java.util.HashMap;
009import java.util.Map;
010
011import armyc2.c5isr.JavaLineArray.LinePattern;
012import armyc2.c5isr.graphics2d.Point2D;
013import armyc2.c5isr.graphics2d.TexturePaint;
014
015/**
016 * Object that holds information on how to draw a multipoint symbol after {@link armyc2.c5isr.web.render.WebRenderer#RenderMultiPointAsMilStdSymbol(String, String, String, String, String, String, double, String, Map, Map)} is called.
017 */
018public class MilStdSymbol
019{
020
021        //private SymbolDef _symbolDefinition = null;
022    //private UnitDef _unitDefinition = null;
023    /**
024     * modifiers
025     */
026    private Map<String,String> _Properties = null;
027
028    //for tactical graphics
029    private ArrayList<Double> _X_Altitude = null;
030    private ArrayList<Double> _AM_Distance = null;
031    private ArrayList<Double> _AN_Azimuth = null;
032
033    private String _symbolID = "";
034
035    /**
036     * unique ID for this symbol, for client use
037     */
038    private String _UUID = null;
039
040    private ArrayList<ShapeInfo> _SymbolShapes;
041
042    /**
043     * collection of shapes for the modifiers
044     */
045    private ArrayList<ShapeInfo> _ModifierShapes;
046
047    private ArrayList<Point2D> _Coordinates;
048
049    private int _UnitSize = 100;
050    private double _scale = 0;
051    private Boolean _KeepUnitRatio = true;
052
053    Integer _LineWidth = 3;
054    Color _LineColor = null;
055    Color _FillColor = null;
056    Color _TextColor = null;
057    Color _TextBackgroundColor = null;
058
059    double _Rotation = 0.0;//DEGREES
060
061    //outline singlepoint TGs
062    boolean _Outline = false;
063    //if null, renderer determines outline Color.
064    Color _OutLineColor = null;
065    int _OutLineWidth = 0;
066    TexturePaint _tp = null;
067    boolean _fs = true;
068
069    int _patternFillType = 0;
070
071    private double patternScale = 1;
072
073    private static String _AltitudeMode = "";
074
075    private static DistanceUnit _AltitudeUnit = null;
076
077    private static DistanceUnit _DistanceUnit = null;
078
079    private static boolean _useDashArray = true;
080
081    private static boolean _useLinePattern  = false;
082
083    private static boolean _hideOptionalLabels = false;
084
085    private static boolean _DrawAffiliationModifierAsLabel = true;
086
087    private static boolean _UseLineInterpolation = false;
088
089    /**
090     * Text is not affected by scale changes
091     */
092    public static final int TextScaleSensitive_No = 0;
093    /**
094     * Text is affected only by significant scale changes
095     */
096    public static final int TextScaleSensitive_OnSlightZoomIn = 1;
097    /**
098     * Text is affected by zoom in scale changes
099     */
100    public static final int TextScaleSensitive_OnZoomIn = 2;
101    /**
102     * Text is affected by any scale changes
103     */
104    public static final int TextScaleSensitive_OnZoomInOut = 3;
105
106    /**
107     * Symbol is not affected by scale changes
108     */
109    public static final int SymbolScaleSensitive_No = 0;
110    /**
111     * Symbol has arrow heads that are affected by scale change
112     */
113    public static final int SymbolScaleSensitive_ArrowHeads = 1;
114    /**
115     * Symbol has lines details that are affected by scale change (like FLOT)
116     */
117    public static final int SymbolScaleSensitive_DecoratedLines = 2;
118    /**
119     * Symbol has pattern fills that are affected by scale if you're not using the fill pattern image
120     * ShapeInfo.getShader() or ShapeInfo.getPatternFillImage()
121     */
122    public static final int SymbolScaleSensitive_PatternFills = 3;
123
124    Object _Tag = null;
125
126    /*
127     * Used to hold metadata for each segment of the symbol for multi-point
128     * symbols. Each segment can contain one object.
129     */
130                //private Map _segmentData;
131                // Constants for dynamic properties
132/*
133     public static final String SYMBOL_ID = "Symbol ID";
134     //public static final String SOURCE = "Source";
135     //public static final String EDITOR_CLASS_TYPE = "Editor Class Type";
136     public static final String URN = "URN";
137     public static final String UIC = "UIC";
138     public static final String ANGLE_OF_ROTATION = "Angle of Rotation";
139     public static final String LENGTH = "Length";
140     public static final String WIDTH = "Width";
141     public static final String RADIUS = "Radius";
142     public static final String SEGMENT_DATA = "Segment Data";
143     */
144
145    /*
146     public static final String GEO_POINT = "point";
147     public static final String GEO_LINE = "line";
148     public static final String GEO_POLYGON = "area";
149     public static final String GEO_TEXT = "text";
150     public static final String GEO_CIRCLE = "circle";
151     public static final String GEO_RECTANGLE = "rectangle";
152     public static final String GEO_ARC = "arc";
153     public static final String GEO_SQUARE = "square";
154     */
155    /*
156     private static final String _COORDINATES = "Coordinates";
157     private static final String _GEOMETRY = "Geometry";
158     private static final String _FILL_COLOR = "Fill Color";
159     private static final String _FILL_ALPHA = "Fill Alpha";
160     private static final String _FILL_STYLE = "Fill Style";
161     private static final String _LINE_WIDTH = "Line Width";
162     private static final String _LINE_COLOR = "Line Color";
163     private static final String _LINE_ALPHA = "Line Alpha";
164     private static final String _TEXT_BACKGROUND_COLOR = "Background Color";
165     private static final String _TEXT_FOREGROUND_COLOR = "Foreground Color";
166     private static final String _USE_FILL = "Use Fill";
167     */
168    /*
169     protected static const _COORDINATES:String = "Coordinates";
170     protected static const _GEOMETRY:String = "Geometry";
171     protected static const _FILL_COLOR:String = "Fill Color";
172     protected static const _FILL_ALPHA:String = "Fill Alpha";
173     private int _FILL_STYLE:String = "Fill Style";
174     protected static const _LINE_WIDTH:String = 0;
175     private Color _LINE_COLOR = Color.BLACK;
176     private int _LINE_ALPHA:String = 0;
177     private Color _TEXT_BACKGROUND_COLOR = Color.WHITE;
178     private Color _TEXT_FOREGROUND_COLOR = Color.BLACK;
179     private bool _USE_FILL:String = "Use Fill";*/
180
181    /**
182     * Creates a new MilStdSymbol.
183     *
184     * @param symbolID code, 20-30 digits long that represents the symbol
185     * @param uniqueID for the client's use
186     * @param modifiers use keys from Modifiers.
187     * @param Coordinates
188     * modifiers
189     */
190    public MilStdSymbol(String symbolID, String uniqueID, ArrayList<Point2D> Coordinates, Map<String,String> modifiers)
191    {
192        this(symbolID, uniqueID, Coordinates, modifiers, true);
193    }
194
195    /**
196     *
197     * @param symbolID code, 20-30 digits long that represents the symbol
198     * @param uniqueID for the client's use
199     * @param modifiers use keys from Modifiers.
200     * @param Coordinates
201     * @param keepUnitRatio - default TRUE
202     * modifiers
203     */
204    public MilStdSymbol(String symbolID, String uniqueID, ArrayList<Point2D> Coordinates, Map<String,String> modifiers, Boolean keepUnitRatio)
205    {
206
207        if (modifiers == null)
208        {
209            _Properties = new HashMap<>();
210        }
211        else
212        {
213            _Properties = modifiers;
214        }
215
216        _UUID = uniqueID;
217        setCoordinates(Coordinates);
218
219        // Set the given symbol id
220        setSymbolID(symbolID);
221
222        // Set up default line fill and text colors
223        _LineColor = SymbolUtilities.getDefaultLineColor(_symbolID);
224        setTextColor(SymbolUtilities.getLineColorOfAffiliation(symbolID));
225        //if(SymbolUtilities.isWarfighting(_symbolID))
226        if (SymbolUtilities.hasDefaultFill(_symbolID))
227        {
228            setFillColor(SymbolUtilities.getFillColorOfAffiliation(_symbolID));
229        }
230            //if(SymbolUtilities.isNBC(_symbolID) && !(SymbolUtilities.isDeconPoint(symbolID)))
231        //    setFillColor(SymbolUtilities.getFillColorOfAffiliation(_symbolID));
232
233        _DrawAffiliationModifierAsLabel = RendererSettings.getInstance().getDrawAffiliationModifierAsLabel();
234
235        _UseLineInterpolation = RendererSettings.getInstance().getUseLineInterpolation();
236
237        _KeepUnitRatio = keepUnitRatio;
238    }
239
240    public TexturePaint getFillStyle()
241    {
242        return _tp;
243    }
244
245    public void setFillStyle(TexturePaint value)
246    {
247        _tp = value;
248    }
249
250    public boolean getUseFillPattern()
251    {
252        return _fs;
253    }
254
255    public void setUseFillPattern(boolean value)
256    {
257        _fs = value;
258    }
259
260    /**
261     * @deprecated
262     */
263    public int getPatternFillType()
264    {
265        return _patternFillType;
266    }
267
268    /**
269     * 0=Solid, 2=ForwardHatch, 3=BackwardHatch, 4=verticalHatch, 5=horizonalHatch, 8=CrossHatch
270     * Only affects Basic Shapes.  Will not apply to MilStd Symbology so as to not confuse some
271     * symbols with others.
272     * @param value
273     *
274     * @deprecated
275     */
276    public void setPatternFillType(int value)
277    {
278        _patternFillType = value;
279    }
280
281    public String getAltitudeMode()
282    {
283        return _AltitudeMode;
284    }
285
286    public void setAltitudeMode(String value)
287    {
288        _AltitudeMode = value;
289    }
290
291    public DistanceUnit getAltitudeUnit(){
292        return _AltitudeUnit;
293    }
294
295    public void setAltitudeUnit(DistanceUnit unit){
296        _AltitudeUnit = unit;
297    }
298
299    public DistanceUnit getDistanceUnit(){
300        return _DistanceUnit;
301    }
302
303    public void setDistanceUnit(DistanceUnit unit){
304        _DistanceUnit = unit;
305    }
306    
307    public boolean getUseDashArray()
308    {
309        return _useDashArray;
310    }
311
312    public void setUseDashArray(boolean value)
313    {
314        _useDashArray = value;
315    }
316
317    public boolean getUseLinePattern()
318    {
319        return _useLinePattern;
320    }
321
322    public void setUseLinePattern(boolean value)
323    {
324        _useLinePattern = value;
325    }
326
327    public boolean getHideOptionalLabels()
328    {
329        return _hideOptionalLabels;
330    }
331
332    public void setHideOptionalLabels(boolean value)
333    {
334        _hideOptionalLabels = value;
335    }
336
337    public void setUseLineInterpolation(boolean value)
338    {
339        _UseLineInterpolation = value;
340    }
341
342    public boolean getUseLineInterpolation()
343    {
344        return _UseLineInterpolation;
345    }
346
347    //Set size for area's internal icon (LAA, mine and CBRN areas)
348    public void setUnitSize(int pixelSize){_UnitSize = pixelSize;}
349
350    public int getUnitSize(){return _UnitSize;}
351
352    public void setKeepUnitRatio(boolean value) {_KeepUnitRatio = value;}
353
354    public boolean getKeepUnitRatio() {return _KeepUnitRatio;}
355
356    /**
357     * Determines how to draw the Affiliation Modifier. True to draw as modifier
358     * label in the "E/F" location. False to draw at the top right corner of the
359     * symbol
360     *
361     * @deprecated
362     */
363    public void setDrawAffiliationModifierAsLabel(boolean value)
364    {
365        _DrawAffiliationModifierAsLabel = value;
366    }
367
368    /**
369     * True to draw as modifier label in the "E/F" location. False to draw at
370     * the top right corner of the symbol
371     *
372     * @deprecated
373     */
374    public boolean getDrawAffiliationModifierAsLabel()
375    {
376        return _DrawAffiliationModifierAsLabel;
377    }
378
379    /**
380     *
381     * @return
382     */
383    public Map<String,String> getModifierMap()
384    {
385        return _Properties;
386    }
387
388    /**
389     *
390     * @param modifiers
391     */
392    public void setModifierMap(Map<String,String> modifiers)
393    {
394        _Properties = modifiers;
395    }
396
397    /**
398     *
399     * @param modifier
400     * @return
401     */
402    public String getModifier(String modifier)
403    {
404        if (_Properties.containsKey(modifier))
405        {
406            return _Properties.get(modifier);
407        }
408        else
409        {
410            return getModifier(modifier, 0);
411        }
412    }
413
414    /**
415     *
416     * @param modifier
417     * @param value
418     */
419    public void setModifier(String modifier, String value)
420    {
421        if (value.equals("") == false)
422        {
423            if (!(modifier == Modifiers.AM_DISTANCE)
424                    || modifier == (Modifiers.AN_AZIMUTH)
425                    || modifier == (Modifiers.X_ALTITUDE_DEPTH))
426            {
427                _Properties.put(modifier, value);
428            }
429            else
430            {
431                setModifier(modifier, value, 0);
432            }
433        }
434    }
435
436    /**
437     *
438     * @param modifier
439     * @param index
440     * @return
441     */
442    public String getModifier(String modifier, int index)
443    {
444        if (_Properties.containsKey(modifier))
445        {
446            return _Properties.get(modifier);
447        }
448        else if (modifier == (Modifiers.AM_DISTANCE)
449                || modifier == (Modifiers.AN_AZIMUTH)
450                || modifier == (Modifiers.X_ALTITUDE_DEPTH))
451        {
452            String value = String.valueOf(getModifier_AM_AN_X(modifier, index));
453            if (value != null && !value.equalsIgnoreCase("null") && !value.equalsIgnoreCase(""))
454            {
455                return value;
456            }
457            else
458            {
459                return null;
460            }
461        }
462        else
463        {
464            return null;
465        }
466
467    }
468
469    /**
470     *
471     * @param modifier
472     * @param index
473     * @return
474     */
475    public Double getModifier_AM_AN_X(String modifier, int index)
476    {
477        ArrayList<Double> modifiers = null;
478        if (modifier == (Modifiers.AM_DISTANCE))
479        {
480            modifiers = _AM_Distance;
481        }
482        else if (modifier == (Modifiers.AN_AZIMUTH))
483        {
484            modifiers = _AN_Azimuth;
485        }
486        else if (modifier == (Modifiers.X_ALTITUDE_DEPTH))
487        {
488            modifiers = _X_Altitude;
489        }
490        else
491        {
492            return null;
493        }
494
495        if (modifiers != null && modifiers.size() > index)
496        {
497            Double value = null;
498            value = modifiers.get(index);
499            if (value != null)
500            {
501                return value;
502            }
503            else
504            {
505                return null;
506            }
507        }
508        else
509        {
510            return null;
511        }
512    }
513
514    /**
515     * Modifiers must be added in order. No setting index 2 without first
516     * setting index 0 and 1. If setting out of order is attempted, the value
517     * will just be added to the end of the list.
518     *
519     * @param modifier
520     * @param value
521     * @param index
522     */
523    public void setModifier(String modifier, String value, int index)
524    {
525        if (value.equals("") == false)
526        {
527            if (!(modifier == (Modifiers.AM_DISTANCE)
528                    || modifier == (Modifiers.AN_AZIMUTH)
529                    || modifier == (Modifiers.X_ALTITUDE_DEPTH)))
530            {
531                _Properties.put(modifier, value);
532            }
533            else
534            {
535                Double dblValue = Double.valueOf(value);
536                if (dblValue != null)
537                {
538                    setModifier_AM_AN_X(modifier, dblValue, index);
539                }
540            }
541        }
542    }
543
544    public void setModifier_AM_AN_X(String modifier, Double value, int index)
545    {
546        if ((modifier == (Modifiers.AM_DISTANCE)
547                || modifier == (Modifiers.AN_AZIMUTH)
548                || modifier == (Modifiers.X_ALTITUDE_DEPTH)))
549        {
550            ArrayList<Double> modifiers = null;
551            if (modifier == (Modifiers.AM_DISTANCE))
552            {
553                if (_AM_Distance == null)
554                {
555                    _AM_Distance = new ArrayList<Double>();
556                }
557                modifiers = _AM_Distance;
558            }
559            else if (modifier == (Modifiers.AN_AZIMUTH))
560            {
561                if (_AN_Azimuth == null)
562                {
563                    _AN_Azimuth = new ArrayList<Double>();
564                }
565                modifiers = _AN_Azimuth;
566            }
567            else if (modifier == (Modifiers.X_ALTITUDE_DEPTH))
568            {
569                if (_X_Altitude == null)
570                {
571                    _X_Altitude = new ArrayList<Double>();
572                }
573                modifiers = _X_Altitude;
574            }
575            if (index + 1 > modifiers.size())
576            {
577                modifiers.add(value);
578            }
579            else
580            {
581                modifiers.set(index, value);
582            }
583        }
584    }
585
586    public ArrayList<Double> getModifiers_AM_AN_X(String modifier)
587    {
588        if (modifier == (Modifiers.AM_DISTANCE))
589        {
590            return _AM_Distance;
591        }
592        else if (modifier == (Modifiers.AN_AZIMUTH))
593        {
594            return _AN_Azimuth;
595        }
596        else if (modifier == (Modifiers.X_ALTITUDE_DEPTH))
597        {
598            return _X_Altitude;
599        }
600
601        return null;
602    }
603
604    public void setModifiers_AM_AN_X(String modifier, ArrayList<Double> modifiers)
605    {
606        if (modifier == (Modifiers.AM_DISTANCE))
607        {
608            _AM_Distance = modifiers;
609        }
610        else if (modifier == (Modifiers.AN_AZIMUTH))
611        {
612            _AN_Azimuth = modifiers;
613        }
614        else if (modifier == (Modifiers.X_ALTITUDE_DEPTH))
615        {
616            _X_Altitude = modifiers;
617        }
618    }
619
620    /**
621     *
622     * @param value
623     */
624    public void setFillColor(Color value)
625    {
626        _FillColor = value;
627    }
628
629    /**
630     *
631     * @return
632     */
633    public Color getFillColor()
634    {
635        return _FillColor;
636    }
637    
638    /**
639    *
640    * @param value
641    */
642   public void setTextColor(Color value)
643   {
644       _TextColor = value;
645       if(RendererSettings.getInstance().getTextBackgroundMethod() != RendererSettings.TextBackgroundMethod_NONE && _TextBackgroundColor == null)
646       {
647           //If text background enabled and a background color has not been set yet:
648          _TextBackgroundColor = RendererUtilities.getIdealOutlineColor(_TextColor);
649       }
650
651   }
652
653   /**
654    *
655    * @return
656    */
657   public Color getTextColor()
658   {
659       return _TextColor;
660   }
661   
662   /**
663   *
664   * @param value
665   */
666  public void setTextBackgroundColor(Color value)
667  {
668      _TextBackgroundColor = value;
669  }
670
671  /**
672   *
673   * @return
674   */
675  public Color getTextBackgroundColor()
676  {
677      return _TextBackgroundColor;
678  }
679
680    /**
681     *
682     * @param value
683     */
684    public void setLineWidth(int value)
685    {
686        _LineWidth = value;
687    }
688
689    /**
690     *
691     * @return
692     */
693    public int getLineWidth()
694    {
695        return _LineWidth;
696    }
697
698    /**
699     * If value is null or SymbolUtilities.isGreenProtectionGraphic() is true then value is ignored
700     *
701     * @param value
702     */
703    public void setLineColor(Color value)
704    {
705        if(!SymbolUtilities.hasStaticLineColor(_symbolID) && value != null)
706        {
707            _LineColor = value;
708        }
709    }
710
711    /**
712     *
713     * @return
714     */
715    public Color getLineColor()
716    {
717        return _LineColor;
718    }
719
720    /**
721     * if null, renderer will use white or black for the outline based on the color
722     * of the symbol. Otherwise, it will used the passed color value.
723     *
724     * @param value
725     */
726    public void setOutlineColor(Color value)
727    {
728        _OutLineColor = value;
729    }
730
731    public Color getOutlineColor()
732    {
733        return _OutLineColor;
734    }
735
736    /**
737     * Extra value for client. defaults to null. Not used for rendering by
738     * JavaRenderer
739     *
740     * @param value
741     * @deprecated
742     */
743    public void setTag(Object value)
744    {
745        _Tag = value;
746    }
747
748    /**
749     * Extra value for client. defaults to null. Not used for rendering by
750     * JavaRenderer
751     *
752     * @return
753     * @deprecated
754     */
755    public Object getTag()
756    {
757        return _Tag;
758    }
759
760    /**
761     *
762     * @param value
763     */
764    public void setCoordinates(ArrayList<Point2D> value)
765    {
766        _Coordinates = value;
767    }
768
769    /**
770     *
771     * @return
772     */
773    public ArrayList<Point2D> getCoordinates()
774    {
775        return _Coordinates;
776    }
777
778    /**
779     * Shapes that represent the symbol modifiers
780     *
781     * @param value ArrayList&lt;Shape&gt;
782     */
783    public void setModifierShapes(ArrayList<ShapeInfo> value)
784    {
785        _ModifierShapes = value;
786    }
787
788    /**
789     * Shapes that represent the symbol modifiers
790     *
791     * @return
792     */
793    public ArrayList<ShapeInfo> getModifierShapes()
794    {
795        return _ModifierShapes;
796    }
797
798    /**
799     * the java shapes that make up the symbol
800     *
801     * @param value ArrayList&lt;ShapeInfo&gt;
802     */
803    public void setSymbolShapes(ArrayList<ShapeInfo> value)
804    {
805        _SymbolShapes = value;
806    }
807
808    /**
809     * the java shapes that make up the symbol
810     *
811     * @return
812     */
813    public ArrayList<ShapeInfo> getSymbolShapes()
814    {
815        return _SymbolShapes;
816    }
817
818    /**
819     * The Symbol Id of the MilStdSymbol.
820     *
821     * @return
822     */
823    public String getSymbolID()
824    {
825        return _symbolID;
826    }
827
828    /**
829     * Unique ID of the Symbol. For client use.
830     *
831     * @return
832     */
833    public String getUUID()
834    {
835        return _UUID;
836    }
837
838    /**
839     * Unique ID of the Symbol. For client use.
840     *
841     * @param ID
842     */
843    public void setUUID(String ID)
844    {
845        _UUID = ID;
846    }
847
848    /**
849     * Sets the Symbol ID for the symbol. Should be a 20-30 digit string from
850     * the milstd.
851     *
852     * @param value
853     */
854    public void setSymbolID(String value)
855    {
856
857        String current = _symbolID;
858
859        try
860        {
861            //set symbolID
862            if (value != null && !value.equals("") && !current.equals(value))
863            {
864                _symbolID = value;
865            }
866
867
868        }// End try
869        catch (Exception e)
870        {
871            // Log Error
872            ErrorLogger.LogException("MilStdSymbol", "setSymbolID" + " - Did not fall under TG or FE", e);
873        }
874    }   // End set SymbolID
875    private boolean _wasClipped=false;
876    /**
877     *
878     * @param value
879     * @deprecated see {@link #setWasClipped(boolean)}
880     */
881    public void set_WasClipped(boolean value)
882    {
883        _wasClipped=value;
884    }
885
886    /**
887     *
888     * @return boolean
889     * @deprecated see {@link #getWasClipped()}
890     */
891    public boolean get_WasClipped()
892    {
893        return _wasClipped;
894    }
895
896    public void setWasClipped(boolean value)
897    {
898        _wasClipped=value;
899    }
900    public boolean getWasClipped()
901    {
902        return _wasClipped;
903    }
904
905
906    /**
907     * Determines if the symbol has integral or modifier/amplifier text that would
908     * be impacted if the maps is zoomed in or out after initial draw.
909     * @return 0=not sensitive, 1=slightly little zoom in sensitive, 2=zoom in sensitive, 3=zoom in/out sensitive
910     */
911    public int isTextScaleSensitive()
912    {
913        ArrayList<ShapeInfo> modifiers = this.getModifierShapes();
914        if(_Properties == null)
915            return 0;//no scale sensitive text
916        if (_Properties.isEmpty())
917            return 0;
918        else if(SymbolID.getSymbolSet(_symbolID)==SymbolID.SymbolSet_ControlMeasure)
919        {
920            MSInfo msi = MSLookup.getInstance().getMSLInfo(_symbolID);
921            if(msi != null)
922            {
923                int dr = msi.getDrawRule();
924                String ec = String.valueOf(SymbolID.getEntityCode(_symbolID));
925                switch (dr)
926                {
927                    case DrawRules.AXIS1:
928                    case DrawRules.AXIS2:
929                        if(_Properties.containsKey(Modifiers.W_DTG_1) ||
930                                _Properties.containsKey(Modifiers.W1_DTG_2))
931                            return 3;
932                        else
933                            return 0;
934                    case DrawRules.CORRIDOR1:
935                        if(_Properties.size() > 1)
936                            return 3;
937                        else
938                            return 0;
939                    case DrawRules.LINE5://Bearing Lines (2201##), Linear Targets (2407##)
940                        if(ec.startsWith("2201"))
941                        {
942                            if(_Properties.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
943                                return 2;
944                            else
945                                return 0;
946                        }
947                        else if(ec.startsWith("2407"))
948                        {
949                            if(modifiers != null && !modifiers.isEmpty())
950                            {
951                                int size = modifiers.size();
952                                if(size == 1)
953                                    return 2;
954                                else//size > 1
955                                    return 3;
956                            }
957                            else
958                                return 0;
959                        }
960                        else
961                            return 0;
962                    case DrawRules.RECTANGULAR1:
963                        if(modifiers != null && modifiers.size() > 1 && ec.startsWith("24"))
964                            return 3;
965                        else
966                            return 0;
967                    case DrawRules.CIRCULAR1:
968                        if(modifiers != null && modifiers.size() > 1 && (ec.startsWith("2003") || ec.startsWith("24")))
969                            return 3;
970                        else
971                            return 0;
972                    case DrawRules.RECTANGULAR3:
973                        if(modifiers != null && !modifiers.isEmpty())
974                            return 2;
975                        else
976                            return 0;
977
978                    case DrawRules.CIRCULAR2:
979                    case DrawRules.ARC1:
980                        return 0;
981                    default:
982                        break;
983                }
984            }
985
986            int ec = (SymbolID.getEntityCode(_symbolID));
987            switch (ec)
988            {
989
990                //A Little Zoom in sensitive (1)
991                case 140300://Phase line, only 5% sensitive
992                case 140400://Forward Edge of Battle, only 5% sensitive
993                case 330100://Moving Convoy
994                case 330200://Halted Convoy
995                    return 1;
996
997                //Zoom in sensitive (2)
998                case 110200://Light Line
999                case 110300://Engineer Work Line
1000                case 140700://Final Coordination Line
1001                case 140900://Limit of Advance
1002                case 141000://Line of Departure
1003                case 141100://Line of Departure / Line of Contact
1004                case 141200://Probable Line of Deployment
1005                case 141400://Bridgehead Line
1006                case 141500://Holding Line
1007                case 141600://Release Line
1008                case 141800://Handover Line
1009                case 141900://Battle Handover Line
1010                case 142000://Named Area of Interest Line (NAI)
1011                case 190100://Identification, Friend-or-Foe (IFF) Off Line
1012                case 190200://Identification, Friend-or-Foe (IFF) On Line
1013                case 200401://Ship Area of Interest, Eclipse/Circle (AEGIS only)
1014                case 200402://Ship Area of Interest, Rectangle (AEGIS only)
1015                case 330300://Main Supply Route (MSR)
1016                case 330301://One Way Traffic
1017                case 330302://Two Way Traffic
1018                case 330303://Alternating Traffic
1019                case 330400://Alternate Supply Route (ASR)
1020                case 330401://One Way Traffic
1021                case 330402://Two Way Traffic
1022                case 330403://Alternating Traffic
1023                    return 2;
1024                case 120400://Airfield Zone
1025                case 142100://Mobility Corridor
1026                case 370100://Human Terrain
1027                    if(_Properties.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
1028                        return 2;
1029                    else
1030                        return 0;
1031                case 290100://Obstacle Line
1032                    if(_Properties.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1))
1033                        return 2;
1034                    else
1035                        return 0;
1036                case 140100://FLOT
1037                    if(SymbolID.getAffiliation(_symbolID)==SymbolID.StandardIdentity_Affiliation_Hostile_Faker)
1038                        return 2;
1039                    else
1040                        return 1;
1041
1042                    //Very Zoom in/out sensitive (multi-line text) (3)
1043                    //friendly and more than 1 text
1044                    //Hostile and more than 3 text assuming ENY is present
1045                case 110100://boundary line
1046                    if(_Properties.containsKey(Modifiers.T_UNIQUE_DESIGNATION_1) ||
1047                            _Properties.containsKey(Modifiers.T1_UNIQUE_DESIGNATION_2) ||
1048                            _Properties.containsKey(Modifiers.AS_COUNTRY))
1049                        return 3;
1050                    else
1051                        return 0;
1052
1053                case 150501://Joint Tactical Action Area (JTAA), 2 rows of text
1054                case 150502://Submarine Action Area (SAA), 2 rows of text
1055                case 150503://Submarine Generated Action Area (SGAA), 2 rows of text
1056                case 200300://No Attack (NOTACK) Zone (AEGIS only)
1057                case 140601://Friendly Aviation
1058                case 140602://Friendly Direction of Main Attack
1059                case 140603://Friendly Direction of Supporting Attack
1060                case 140605://Direction of Attack Feint
1061                    if(_Properties.containsKey(Modifiers.W_DTG_1) ||
1062                            _Properties.containsKey(Modifiers.W1_DTG_2))
1063                        return 3;
1064                    else
1065                        return 0;
1066                case 151100://Limited Access Area if sector 1 modifier present
1067                    if(SymbolID.getModifier1(_symbolID)!=0 || _Properties.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
1068                        return 3;
1069                    else
1070                        return 0;
1071
1072                case 152400://Restricted Terrain
1073                case 152500://Severly Restricted Terrain
1074                    if(modifiers != null && modifiers.size()>1)
1075                        return 3;
1076                    else
1077                        return 0;
1078
1079                    //Labels all contained in area but can drift away from each-other or overlap
1080                case 120700: //Generic
1081                case 170900: //High-Density Airspace Control Zone
1082                case 171000: //Restricted Operations Zone (ROZ)
1083                case 171100: //Air-to-Air Restricted Operations Zone (AARROZ)
1084                case 171200: //Unmanned Aircraft Restricted Operations Zone (UA-ROZ)
1085                case 171300: //Weapon Engagement Zone
1086                case 171400: //Fighter Engagement Zone (FEZ)
1087                case 171500: //Joint Engagement Zone (JEZ)
1088                case 171600: //Missile Engagement Zone (MEZ)
1089                case 171700: //Low (Altitude) Missile Engagement Zone (LOMEZ)
1090                case 171800: //High (Altitude) Missile Engagement Zone (HIMEZ)
1091                case 171900: //Short Range Air Defense Engagement Zone (SHORADEZ)
1092                case 172000: //Weapons Free Zone
1093                case 240101: //Airspace Coordination Area (ACA) - Irregular
1094                case 240201: //Free Fire Area (FFA) - Irregular
1095                case 240301: //No Fire Area (NFA) - Irregular
1096                case 240401: //Restricted Fire Area (RFA) - Irregular
1097                case 240806: //Smoke
1098                case 241001://Fire Support Area - Irregular
1099                case 241101: //Artillery Target Intelligence Zone (ATI), - Irregular
1100                case 241201: //Call For Fire Zone (CFFZ) - Irregular
1101                case 241301: //Censor Zone, - Irregular
1102                case 241401: //Critical Friendly Zone (CFZ), - Irregular
1103                case 241501: //Dead Space Area (DA), - Irregular
1104                case 241601: //Sensor Zone, Irregular
1105                case 241701: //Target Build-up Area, Irregular
1106                case 241801: //Target Value Area, Irregular
1107                case 241901: //Zone of Responsibility, Irregular
1108                case 242000: //Terminally Guided Munition Footprint (TGMF)
1109                case 242702: //Psyops Zone, Irregular
1110                case 242800: //Kill Zone
1111                case 242301: //Blue Kill Box, Irregular
1112                case 242304: //Purple Kill Box, Irregular
1113                case 270300: //Obstacle Free Zone
1114                case 290600: //Lane
1115                case 310100: //Detainee Holding Area
1116                case 310200: //Enemy Prisoner of War Holding Area
1117                case 310300: //Forward Arming and Refueling Point (FARP)
1118                case 310400: //Refugee Holding Area
1119                case 310800: //Corps Support Area (CSA)
1120                    if(modifiers != null && modifiers.size()>1)
1121                        return 3;
1122                    else
1123                        return 0;
1124
1125                    //CASES for areas with 4 tags like PAA
1126                case 242400: //Artillery Manoeuvre Area (AMA)
1127                case 240501: //Position Area for Artillery (PAA) - Irregular
1128                    if(modifiers != null && modifiers.size()>4)
1129                        return 3;
1130                    else
1131                        return 0;
1132
1133                case 110400://Generic
1134                case 260100://Fire Support Coordination Line (FSCL)
1135                case 260200://Coordinated Fire Line (CFL)
1136                case 260300://No Fire Line
1137                case 260400://Battlefield Coordination Line
1138                case 260500://Restrictive Fire Line
1139                case 300100://Intelligence Coordination Line (ICL)
1140                    if(_Properties.containsKey(Modifiers.W_DTG_1) ||
1141                            _Properties.containsKey(Modifiers.W1_DTG_2))
1142                        return 3;
1143                    else
1144                        return 2;
1145
1146                case 260600://Munition Flight Path
1147                case 340800://Delay
1148                    if(_Properties.containsKey(Modifiers.W_DTG_1) ||
1149                            _Properties.containsKey(Modifiers.W1_DTG_2))
1150                        return 2;
1151                    else
1152                        return 0;
1153
1154                case 270800://Mined Area
1155                    if(_Properties.containsKey(Modifiers.W_DTG_1) ||
1156                            _Properties.containsKey(Modifiers.H_ADDITIONAL_INFO_1))
1157                        return 2;
1158                    else
1159                        return 0;
1160
1161                case 220109://Navigational Rhumb Line
1162                    if(modifiers != null && modifiers.size() > 1)
1163                        return 3;
1164                    else
1165                        return 2;
1166
1167                case 271100://Bridge or Gap
1168                case 271300://Assault Crossing
1169                    if(_Properties.containsKey(Modifiers.W_DTG_1) ||
1170                            _Properties.containsKey(Modifiers.W1_DTG_2))
1171                        return 3;
1172                    else //TODO: Bridge or Fix placement and it will be a 0 in other cases
1173                        return 2;
1174
1175                default://No Scale Sensitive text
1176                    return 0;
1177            }
1178        }
1179
1180        return 0;
1181    }
1182
1183    /**
1184     * Checks if the symbol has features that make it scale aware and would require a refresh
1185     * on zooming in or out.
1186     * @return 0=No,1=arrowheads,2=decoratedLines,3=patternFills
1187     */
1188    public int isSymbolScaleSensitive()
1189    {
1190        //return SymbolUtilities.isScaleAware(this._symbolID);
1191        int ec = SymbolID.getEntityCode(_symbolID);
1192
1193        if(SymbolID.getSymbolSet(_symbolID)==SymbolID.SymbolSet_ControlMeasure) {
1194            switch (ec)
1195            {
1196                //ArrowHead or smaller detail
1197                case 152000://Attack By Fire
1198                case 152100://Attack By Fire
1199                case 152200://Search Area/Reconnaissance Area
1200                case 141700://Ambush
1201                case 140601://Airborne/Aviation
1202                case 140602://Direction of Main attack
1203                case 140603://Direction of Supporting attack
1204                case 140605://Direction of Supporting attack Feint
1205                case 142100://Mobility Corridor
1206                case 240701://Linear Target
1207                case 240702://Linear Smoke Target
1208                case 240703://Final Protective Fire
1209                case 242200://Sector Range Fan
1210                case 270502://Disrupt
1211                case 270504://Turn
1212                case 270601://Obstacle Bypass Easy
1213                case 270602://Obstacle Bypass Difficult
1214                case 270603://Obstacle Bypass Impossible
1215                case 271100://Bridge or Gap?
1216                case 271300://Assault Crossing?
1217                case 280100://Abatis?
1218                case 290600://?Lane?
1219                case 290700://Ferry
1220                case 290800://Raft Site
1221                case 340200://Breach
1222                case 340300://Bypass
1223                case 340400://Canalize
1224                case 340500://Clear
1225                case 340800://Delay
1226                case 341000://Disrupt
1227                case 341200://Follow and Assume
1228                case 341300://Follow and Support
1229                    //case 341700://Occupy, details relative to size
1230                    //case 341800://Penetrate, details relative to size
1231                    //case 341900://Relief in Place (RIP), details relative to size
1232                    //case 342000://Retire/Retirement, details relative to size
1233                case 342100://Secure, details relative to size
1234                case 342201://Cover, details relative to size
1235                case 342202://Guard, details relative to size
1236                case 342203://Screen, details relative to size
1237                case 342300://Seize, details relative to size
1238                case 342400://Withdraw, details relative to size
1239                case 342500://Withdraw under pressure, details relative to size
1240                case 343000://Capture
1241                case 343200://Control
1242                case 343300://Demonstrate
1243                case 343400://Deny
1244                case 343500://Development
1245                //case 343600://Escort
1246                case 343700://Exfiltration
1247                case 343800://Infiltration
1248                case 343900://Locate
1249                case 344000://Pursuit
1250                case 344100://Forward Passage of Lines
1251                case 344200://Rearward Passage of Lines
1252                case 344400://Disengage
1253                case 344500://Evacuate
1254                case 344600://Recover
1255                case 344700://Turn
1256                    return 1;//arrowhead
1257
1258                //Decorated Lines
1259                case 130701://Decision Line
1260                case 140100://FLOT
1261                case 140200://Line of Contact
1262                    //case 140500://?Principal Direction of Fire?
1263                case 151000://Fortified Area
1264                case 151800://Encirclement
1265                case 151203://Strong Point
1266                case 151202://Battle Position Prepared (P) but not Occupied
1267                case 151204://Contain
1268                case 151205://Retain
1269                case 152600://Area Defense
1270                case 152800://Mobile Defense
1271                case 270100://Obstacle Belt
1272                case 270200://Obstacle Zone
1273                case 270300://Obstacle Free Zone
1274                case 270400://Obstacle Restricted Zone
1275                case 270503://Fix?
1276                case 270801://Mined Area, Fenced
1277                case 282003://Overhead Wire
1278                case 290100://Obstacle Line
1279                case 290201://Ditch Under Construction
1280                case 290202://Ditch Completed
1281                case 290203://Ditch Reinforced
1282                case 290204://Antitank Wall
1283                case 290301://Wire Obstacles, Unspecified
1284                case 290302://Wire Obstacles, Single Fence
1285                case 290303://Wire Obstacles, Double Fence
1286                case 290304://Wire Obstacles, Double Apron Fence
1287                case 290305://Wire Obstacles, Low Wire Fence
1288                case 290306://Wire Obstacles, High Wire Fence
1289                case 290307://Wire Obstacles, Single Concertina
1290                case 290308://Wire Obstacles, Double Strand Concertina
1291                case 290309://Wire Obstacles, Triple Strand Concertina
1292                case 290900://Fortified Line
1293                case 291000://Fighting Position?
1294                case 330100://Moving Convoy
1295                case 330200://Halted Convoy
1296                case 330301://MSR One Way Traffic
1297                case 330302://MSR Two Way Traffic
1298                case 330303://MSR Alternating Traffic
1299                case 330401://ASR One Way Traffic
1300                case 330402://ASR Two Way Traffic
1301                case 330403://ASR Alternating Traffic
1302                case 341100://Fix
1303                case 341500://Isolate, most detail contained inside
1304                case 342600://Cordon and Knock, most detail contained inside
1305                case 342700://Cordon and Search, most detail contained inside
1306                    if(getUseLinePattern() && LinePattern.supportsLinePattern(_symbolID))
1307                        return 0;//using pattern, don't need to refresh
1308                    else
1309                        return 2;//decoration
1310
1311                //Areas with Pattern Fill
1312                case 151100://Limited Access Area
1313                case 172000://Weapons Free Zone
1314                case 152400://Restricted Terrain
1315                case 152500://Severely Restricted Terrain
1316                case 240301://NFA Irregular
1317                case 240302://NFA Rectangular
1318                case 240303://NFA Circular
1319                case 271700://Bio Contaminated Area
1320                case 271701://Bio Contaminated Area - Toxic
1321                case 271800://Chem Contaminated Area
1322                case 271801://Chem Contaminated Area - Toxic
1323                case 271900://Nuc Contaminated Area
1324                case 272000://Rad Contaminated Area
1325                case 272001://Rad Contaminated Area - Toxic
1326                    if(!this.getUseFillPattern())
1327                        return 3;//pattern fill
1328                    else
1329                        return 0;
1330                default:
1331                    return 0;
1332            }
1333        }
1334
1335        return 0;
1336    }
1337
1338    /**
1339     * Multipoint features and patterns scale with line width ({@link #getLineWidth()}).
1340     * {@link #patternScale} is the ratio of how much to increase features and patterns by with line width.
1341     * default value is 1.0. Can be set with {@link RendererSettings#setPatternScale(double)} and {@link MilStdAttributes#PatternScale}
1342     * @param scale
1343     */
1344    public void setPatternScale(double scale) {
1345        patternScale = scale;
1346    }
1347
1348    public double getPatternScale() {
1349        return patternScale;
1350    }
1351
1352}