/** * given the milstd symbol code, find the font index for the symbol. * @param symbolCode * @return */ public int getCharCodeFromSymbol(String symbolCode) { try { String basicID = symbolCode; if (SymbolUtilities.isWeather(symbolCode) == false) { basicID = SymbolUtilities.getBasicSymbolID(symbolCode); } if (_TGLookup.ContainsKey(basicID)) { return(_TGLookup[basicID]); } else { return(-1); } } catch (Exception exc) { ErrorLogger.LogException("TacticalGraphicLookup", "getCharCodeFromSymbol", exc, ErrorLevel.WARNING); } return(-1); }
public UnitFontLookupInfo getLookupInfo(String SymbolID) { try { String code = SymbolUtilities.getBasicSymbolID(SymbolID); // if(SymbolUtilities.isSIGINT(SymbolID)) // code = code.substring(0, 10) + "--***"; // else code = code.Substring(0, 10) + "*****"; UnitFontLookupInfo data = null; if (_UnitMappings.ContainsKey(code)) { data = _UnitMappings[code]; } return(data); } catch (Exception exc) { ErrorLogger.LogException("UnitFontLookupC", "getLookupInfo()", exc, ErrorLevel.WARNING); return(null); } }
private static int getSubSurfaceFill(String SymbolID) { char affiliation = '0'; char status = '0'; int returnVal = '0'; returnVal = 831; try { char[] arrID = SymbolID.ToCharArray(); affiliation = arrID[1]; //F,H,N,U,etc... status = arrID[3]; //A,P,C,D,X,F if (affiliation == 'F' || affiliation == 'A' || affiliation == 'D' || affiliation == 'M' || affiliation == 'J' || affiliation == 'K') { returnVal = 831; // } else if (affiliation == 'H' || affiliation == 'S') //hostile,suspect { returnVal = 828; //index in font file } else if (affiliation == 'N' || affiliation == 'L') //neutral,exercise neutral { returnVal = 834; } else if (affiliation == 'P' || affiliation == 'U' || affiliation == 'G' || affiliation == 'W') { returnVal = 837; //index in font file } //2525C///////////////////////////////////////////////////////////////////////////////// /*if(SymbolID.indexOf("WM")==4 || //Sea Mine * SymbolID.indexOf("WDM")==4 ||//Sea Mine Decoy * SymbolUtilities.getBasicSymbolID(SymbolID).equalsIgnoreCase("S*U*E-----*****") || * SymbolUtilities.getBasicSymbolID(SymbolID).equalsIgnoreCase("S*U*V-----*****") || * SymbolUtilities.getBasicSymbolID(SymbolID).equalsIgnoreCase("S*U*X-----*****")) * { * returnVal++; * * * * * if(status == 'A') * returnVal++; * * } * else if(SymbolUtilities.getBasicSymbolID(SymbolID).equalsIgnoreCase("S*U*ND----*****")) * { * returnVal = 2121; * }//*/ ////////////////////////////////////////////////////////////////////////////////////////// //2525Bch2 if (SymbolID.IndexOf("WM") == 4) //Sea Mine { if (SymbolID.IndexOf("----", 6) == 6 || SymbolID.IndexOf("D---", 6) == 6) { returnVal = 2059; // } else if (SymbolID.IndexOf("G---", 6) == 6) { returnVal = 2062; } else if (SymbolID.IndexOf("GD--", 6) == 6) { returnVal = 2064; } else if (SymbolID.IndexOf("M---", 6) == 6) { returnVal = 2073; } else if (SymbolID.IndexOf("MD--", 6) == 6) { returnVal = 2075; } else if (SymbolID.IndexOf("F---", 6) == 6) { returnVal = 2084; } else if (SymbolID.IndexOf("FD--", 6) == 6) { returnVal = 2086; } else if (SymbolID.IndexOf("O---", 6) == 6 || SymbolID.IndexOf("OD--", 6) == 6) { returnVal = 2094; } } else if (SymbolID.IndexOf("WDM") == 4) //Sea Mine Decoy { returnVal = 2115; } else if (SymbolUtilities.getBasicSymbolID(SymbolID).ToUpper() == ("S*U*ND----*****")) { returnVal = 2121; } //*/ } catch (Exception exc) { ErrorLogger.LogException("UnitFontLookupC", "getSubSurfaceFill", exc); return(831); } return(returnVal); }
private static int getSubSurfaceFrame(String SymbolID, int fillCode) { int returnVal = 0; returnVal = 831; try { //2525C///////////////////////////////////////////////////////////////////////////////// /*if(SymbolID.indexOf("WM")==4 || //Sea Mine * SymbolID.indexOf("WDM")==4 ||//Sea Mine Decoy * SymbolUtilities.getBasicSymbolID(SymbolID).equalsIgnoreCase("S*U*E-----*****") || * SymbolUtilities.getBasicSymbolID(SymbolID).equalsIgnoreCase("S*U*V-----*****") || * SymbolUtilities.getBasicSymbolID(SymbolID).equalsIgnoreCase("S*U*X-----*****")) * { * returnVal = -1; * } * else if(SymbolUtilities.getBasicSymbolID(SymbolID).equalsIgnoreCase("S*U*ND----*****")) * { * returnVal = -1; * } * else * { * if(SymbolID.charAt(3)=='A' || SymbolID.charAt(3)=='a') * return fillCode + 2; * else * return fillCode + 1; * }//*/ ////////////////////////////////////////////////////////////////////////////////////////// //2525Bch2 if (SymbolID.IndexOf("WM") == 4) //Sea Mine { returnVal = -1; } else if (SymbolID.IndexOf("WDM") == 4) //Sea Mine Decoy { returnVal = -1; } else if (SymbolUtilities.getBasicSymbolID(SymbolID).ToUpper() == ("S*U*ND----*****")) { returnVal = -1; } //*/ else { if (SymbolID.Substring(3, 1).ToUpper() == "A") { return(fillCode + 2); } else { return(fillCode + 1); } } } catch (Exception exc) { ErrorLogger.LogException("UnitFontLookupC", "getSubSurfaceFrame", exc); return(fillCode); } return(returnVal); }
/** * 2525C * returns the character index for the fill frame based on the symbol code. * @param SymbolID 15 character symbol ID * @return fill character index */ public static int getFillCode(String SymbolID) { int returnVal = -1; char scheme = '0'; char battleDimension = '0'; char status = '0'; char affiliation = '0'; char grdtrkSubset = '0'; //char foo = 'a'; try { //to upper if (SymbolID != null && SymbolID.Length == 15) { char[] arrID = SymbolID.ToCharArray(); scheme = arrID[0]; //S,O,E,I,etc... affiliation = arrID[1]; //F,H,N,U,etc... battleDimension = arrID[2]; //P,A,G,S,U,F,X,Z status = arrID[3]; //A,P,C,D,X,F grdtrkSubset = arrID[4]; if (scheme == 'S') //Warfighting symbols { if (affiliation == 'F' || affiliation == 'A' || affiliation == 'D' || affiliation == 'M' || affiliation == 'J' || affiliation == 'K') { if (battleDimension == 'Z') //unknown { returnVal = 812; //index in font file } else if (battleDimension == 'F' || battleDimension == 'G' || battleDimension == 'S') //ground & SOF & sea surface { if (battleDimension == 'F' || (battleDimension == 'G' && (grdtrkSubset == 'U' || grdtrkSubset == 'I' || grdtrkSubset == '0' || grdtrkSubset == '-'))) { returnVal = 803; } else if (battleDimension == 'S' || (battleDimension == 'G' && grdtrkSubset == 'E')) { returnVal = 812; } else { returnVal = 803; } } else if (battleDimension == 'A') //Air { returnVal = 819; } else if (battleDimension == 'U') //Subsurface { returnVal = getSubSurfaceFill(SymbolID); } else if (battleDimension == 'P') //space { returnVal = 843; } } else if (affiliation == 'H' || affiliation == 'S') //hostile,suspect { if (battleDimension == 'Z') //unknown { returnVal = 806; //index in font file } else if (battleDimension == 'F' || battleDimension == 'G' || battleDimension == 'S') //ground & SOF & sea surface { returnVal = 806; } else if (battleDimension == 'A') //Air { returnVal = 816; } else if (battleDimension == 'U') //Subsurface { returnVal = getSubSurfaceFill(SymbolID); } else if (battleDimension == 'P') //space { returnVal = 840; } else { returnVal = 806; } } else if (affiliation == 'N' || affiliation == 'L') //neutral,exercise neutral { if (battleDimension == 'Z') //unknown { returnVal = 809; //index in font file } else if (battleDimension == 'F' || battleDimension == 'G' || battleDimension == 'S') //ground & SOF & sea surface { returnVal = 809; } else if (battleDimension == 'A') //Air { returnVal = 822; } else if (battleDimension == 'U') //Subsurface { returnVal = getSubSurfaceFill(SymbolID); } else if (battleDimension == 'P') //space { returnVal = 846; } else { returnVal = 809; } } else if (affiliation == 'P' || affiliation == 'U' || affiliation == 'G' || affiliation == 'W') { if (battleDimension == 'Z' || //unknown battleDimension == 'G' || //ground battleDimension == 'S' || //sea surface battleDimension == 'F') //SOF { returnVal = 800; //index in font file } else if (battleDimension == 'A') //Air { returnVal = 825; } else if (battleDimension == 'U') //Subsurface { returnVal = getSubSurfaceFill(SymbolID); } else if (battleDimension == 'P') //space { returnVal = 849; } else { returnVal = 800; } } } //end if scheme == 's' else if (scheme == 'E') //Emergency Management Symbols { if (affiliation == 'F' || affiliation == 'A' || affiliation == 'D' || affiliation == 'M' || affiliation == 'J' || affiliation == 'K') { //EMS symbols break some rules about symbol codes if (SymbolUtilities.isEMSEquipment(SymbolID)) { returnVal = 812; } else if (battleDimension != 'N') //natural events { returnVal = 803; } else { returnVal = -1; //natural events do not have a fill/frame } } else if (affiliation == 'H' || affiliation == 'S') //hostile,suspect { returnVal = 806; //index in font file } else if (affiliation == 'N' || affiliation == 'L') //neutral,exercise neutral { returnVal = 809; } else /*if(affiliation == 'P' || * affiliation == 'U' || * affiliation == 'G' || * affiliation == 'W')*/ { returnVal = 800; //index in font file } } //end if scheme == 'E' else if (scheme == 'I') //Also default behavior { if (affiliation == 'F' || affiliation == 'A' || affiliation == 'D' || affiliation == 'M' || affiliation == 'J' || affiliation == 'K') { if (battleDimension == 'Z') //unknown { returnVal = 812; //index in font file } else if (battleDimension == 'F' || battleDimension == 'G' || battleDimension == 'S') //ground & SOF & sea surface { if (scheme == 'I') { returnVal = 812; } else { returnVal = 803; } } else if (battleDimension == 'A') //Air { returnVal = 819; } else if (battleDimension == 'U') //Subsurface { returnVal = 831; } else if (battleDimension == 'P') //space { returnVal = 843; } else { if (scheme == 'I') { returnVal = 812; } else { returnVal = 803; } } } if (affiliation == 'H' || affiliation == 'S') //hostile,suspect { if (battleDimension == 'Z') //unknown { returnVal = 806; //index in font file } else if (battleDimension == 'F' || battleDimension == 'G' || battleDimension == 'S') //ground & SOF & sea surface { returnVal = 806; } else if (battleDimension == 'A') //Air { returnVal = 816; } else if (battleDimension == 'U') //Subsurface { returnVal = 828; } else if (battleDimension == 'P') //space { returnVal = 840; } else { returnVal = 806; } } if (affiliation == 'N' || affiliation == 'L') //neutral,exercise neutral { if (battleDimension == 'Z') //unknown { returnVal = 809; //index in font file } else if (battleDimension == 'F' || battleDimension == 'G' || battleDimension == 'S') //ground & SOF & sea surface { returnVal = 809; } else if (battleDimension == 'A') //Air { returnVal = 822; } else if (battleDimension == 'U') //Subsurface { returnVal = 834; } else if (battleDimension == 'P') //space { returnVal = 846; } else { returnVal = 809; } } else if (affiliation == 'P' || affiliation == 'U' || affiliation == 'G' || affiliation == 'W') { if (battleDimension == 'Z' || //unknown battleDimension == 'G' || //ground battleDimension == 'S' || //sea surface battleDimension == 'F') //SOF { returnVal = 800; //index in font file } else if (battleDimension == 'A') //Air { returnVal = 825; } else if (battleDimension == 'U') //Subsurface { returnVal = 837; } else if (battleDimension == 'P') //Subsurface { returnVal = 849; } else { returnVal = 800; } } } //end if scheme == 'I' else //scheme = 'O' and anything else { if (affiliation == 'F' || affiliation == 'A' || affiliation == 'D' || affiliation == 'M' || affiliation == 'J' || affiliation == 'K') { //EMS symbols break some rules about symbol codes if (SymbolUtilities.isEMSEquipment(SymbolID)) { returnVal = 812; } else if (battleDimension != 'N') //natural events { returnVal = 803; } else { returnVal = -1; //natural events do not have a fill/frame } } else if (affiliation == 'H' || affiliation == 'S') //hostile,suspect { returnVal = 806; //index in font file } else if (affiliation == 'N' || affiliation == 'L') //neutral,exercise neutral { returnVal = 809; } else /*if(affiliation == 'P' || * affiliation == 'U' || * affiliation == 'G' || * affiliation == 'W')*/ { returnVal = 800; //index in font file } } //end default } } catch (Exception exc) { ErrorLogger.LogException("UnitFontLookup", "getFillCode", exc, ErrorLevel.SEVERE); } return(returnVal); }