001/*
002 * To change this template, choose Tools | Templates
003 * and open the template in the editor.
004 */
005
006package armyc2.c2sd.renderer.utilities;
007
008import java.io.DataInputStream;
009import java.io.DataOutputStream;
010import java.io.IOException;
011
012/**
013*
014* @author michael.spinelli
015*/
016public class UnitDef {
017
018        /**
019        * Just a category in the milstd hierarchy.
020        * Not something we draw.
021        * WILL NOT RENDER
022        */
023   static public final int DRAW_CATEGORY_DONOTDRAW = 0;
024    /**
025        * Shape is defined by a single point
026        * 0 control points
027        */
028   static public final int DRAW_CATEGORY_POINT = 8;
029
030
031   private String _basicSymbolId = "";
032   private String _description = "";
033   private int _drawCategory = 0;
034   private String _hierarchy = "";
035   private String _path = "";
036   /**
037    * 
038    * @param symbolID
039    * @param description
040    * @param idc drar
041    * @param hierarchy
042    * @param path
043    */
044   public UnitDef(String basicSymbolID, String description, int drawCategory, String hierarchy, String path)
045   {
046           //Set fields to their default values.
047           _basicSymbolId = basicSymbolID;
048           _description = description;
049           _drawCategory = drawCategory;
050           _hierarchy = hierarchy;
051           _path = path;
052   }
053
054
055
056   /**
057    * The basic 15 character basic symbol Id.
058    */
059   
060   public String getBasicSymbolId()
061   {
062           return _basicSymbolId;
063   }
064
065
066   /**
067    * The description of this tactical graphic.  Typically the name of the tactical graphic in MIL-STD-2525B.
068    */
069   
070   public String getDescription()
071   {
072           return _description;
073   }
074
075
076   /**
077    * 8 is singlepoint unit, 0 is category
078    * (do not draw because it's just a category node in the tree)
079    * @return
080    */
081   public int getDrawCategory()
082   {
083           return _drawCategory;
084   }
085
086
087
088   /**
089    * Defines where the symbol goes in the ms2525 hierarchy.
090    * 2.X.whatever
091    */
092
093   public String getHierarchy()
094   {
095           return _hierarchy;
096   }
097
098
099
100    /**
101    * Defines where the symbol goes in the ms2525 hierarchy.
102    * STBOPS.INDIV.WHATEVER
103    */
104   /*private String _strAlphaHierarchy;
105   public String getAlphaHierarchy()
106   {
107           return _strAlphaHierarchy;
108   }//*/
109
110
111           
112        /**
113        * Defines where the symbol goes in the ms2525 hierarchy.
114         * Warfighting/something/something
115        */
116   public String getFullPath()
117   {
118           return _path;
119   }
120
121    static UnitDef readBinary(DataInputStream dis) throws IOException
122    {
123        String _basicSymbolId = dis.readUTF();
124        String _description = dis.readUTF();
125        int _drawCategory = dis.readInt();
126        String _hierarchy = dis.readUTF();
127        String _path = dis.readUTF();
128
129        return new UnitDef(_basicSymbolId, _description, _drawCategory, _hierarchy, _path);
130    }
131}