Ejemplo n.º 1
0
  private SocialPerson createPerson(VertexRecord record, SQLDumpReader sqlData) {
    Person matsimPerson = PersonImpl.createPerson(Id.create(record.id, Person.class));
    SocialPerson person = new SocialPerson(matsimPerson);

    int age;
    if (record.isEgo) age = sqlData.getEgoAge(record.egoSQLId);
    else age = sqlData.getAlterAge(record.alterKeys);

    if (age < 0) errLogger.logNoAge(record.isEgo);
    else PersonUtils.setAge(matsimPerson, age);

    String sex = sqlData.getSex(record);
    if (sex != null) PersonUtils.setSex(matsimPerson, sex);
    else errLogger.logNoSex(record.isEgo);

    if (record.isEgo) PersonUtils.setLicence(matsimPerson, sqlData.getLicense(record));

    if (record.isEgo) PersonUtils.setCarAvail(matsimPerson, sqlData.getCarAvail(record));

    person.setCitizenship(sqlData.getCitizenship(record));
    person.setEducation(sqlData.getEducation(record));
    person.setIncome(sqlData.getIncome(record));
    person.setCivilStatus(sqlData.getCivilStatus(record));
    return person;
  }
Ejemplo n.º 2
0
  /** evaluates the operator */
  public OperandToken evaluate(Token[] operands, GlobalValues globals) {
    if (breakHit || continueHit) return null;

    ErrorLogger.debugLine("DotOperatorToken: evaluate");

    //  syntax is <left><dot><right>  (e.g. a.b)
    Token left = operands[0];
    Token right = operands[1];

    left = left.evaluate(null, globals);

    // not needed. is done by variable token
    // check if left is a variable (e.g. a.abc, where "a" is a structure)
    // if(operands[0] instanceof VariableToken)
    // {
    //    String objName      = ((VariableToken)operands[0]).getName();
    //    String fieldName    = operands[1].toString();
    //
    //    MathLibObject obj   = (MathLibObject)(getVariables().getVariable(objName).getData());
    //    OperandToken  op    = obj.getFieldData(fieldName);
    //
    //    ErrorLogger.debugLine("DotOperatorToken getting object " + objName);
    //    return op.evaluate(null);
    // }

    // (e.g. a.sin() or a.getColor() or 2.sin or 3.sin() )
    String name = "";

    if (right instanceof FunctionToken) {
      name = ((FunctionToken) right).getName();
    }

    if (!name.equals("")) {
      try {
        // check if a function with this name exists
        if (globals.getFunctionManager().findFunctionByName(name) != null) {
          ErrorLogger.debugLine("parser value.function");
          FunctionToken func = new FunctionToken(name, (OperandToken) left);

          return func.evaluate(null, globals);
        }
      } catch (Exception e) {
      }
    }

    // if(function != null)
    // {
    // }
    // else
    // {
    //    String firstParam = operandStack.pop().toString();
    //    ErrorLogger.debugLine("parser value.field");
    //    OperandToken tree = new VariableToken(token.toString(), firstParam);
    //    return tree;
    // }

    return null;
  }
Ejemplo n.º 3
0
  /**
   * @param SymbolID
   * @param symbologyStandard
   * @return
   */
  public UnitFontLookupInfo getLookupInfo(String SymbolID, int symbologyStandard) {
    try {
      String code = SymbolUtilities.getBasicSymbolID(SymbolID);
      //        if(SymbolUtilities.isSIGINT(SymbolID))
      //            code = code.substring(0, 10) + "--***";
      //        else
      //            code = code.substring(0, 10) + "*****";

      if (code.length() >= 10) {
        code = code.substring(0, 10) + "*****";
      }

      UnitFontLookupInfo data = null;
      if (symbologyStandard == RendererSettings.Symbology_2525Bch2_USAS_13_14) {
        data = hashMapB.get(code);
      } else {
        data = hashMapC.get(code);
      }
      return data;
    } catch (Exception exc) {
      ErrorLogger.LogException(
          "UnitFontLookup", "getLookupInfo(" + String.valueOf(SymbolID) + ")", exc, Level.WARNING);
      return null;
    }
  }
Ejemplo n.º 4
0
 /**
  * Updates user profile with new values and adds a picture to user profile if one is selected.
  *
  * @param user <code>AppUser</code> type value of user
  * @param password <code>String</code> type value of user password
  * @param name <code>String</code> type value of user name
  * @param lastname <code>String</code> type value of user lastname
  * @param phone <code>String</code> type value of user phone
  * @param profileImage <code>Image</code> type value of user profile image
  * @return <code>boolean</code> type value true if user profile was successfully updated, false if
  *     not
  */
 public static boolean updateUserProfile(
     AppUser user,
     String password,
     String name,
     String lastname,
     String phone,
     Image profileImage) {
   if (user != null) {
     try {
       user.firstname = name;
       user.lastname = lastname;
       user.password = password;
       user.hashPass();
       user.phoneNumber = phone;
       if (profileImage != null) {
         user.profileImg = profileImage;
       }
       user.update();
       return true;
     } catch (PersistenceException e) {
       ErrorLogger.createNewErrorLogger("Failed to update user profile.", e.getMessage());
       return false;
     }
   }
   return false;
 }
Ejemplo n.º 5
0
 /**
  * This switchImage method uses a try-catch statement in order to switch the images for the
  * various sprite.
  */
 protected void switchImage() {
   try {
     if (++drawKey >= imageKeys.length) {
       drawKey = 0;
     }
   } catch (Exception e) {
     ErrorLogger.logError("Can't swich images " + e);
   }
 }
Ejemplo n.º 6
0
 /**
  * This GameObject class is passed down the int imageKeys and the int keyCount. the images
  *
  * @param imageKeys
  * @param keyCount
  */
 public GameObject(int[] imageKeys, int keyCount) {
   super(1, true);
   try {
     this.imageKeys = imageKeys;
     keyTime = keyCount;
     maxKeyTime = keyCount;
   } catch (Exception e) {
     ErrorLogger.logError("Can't Make Game Object " + e);
   }
 }
Ejemplo n.º 7
0
    public void load() {
        try {
            synchronized (mutex) {
                plugin.getLogger().log(Level.INFO, "Loading configuration file: " + name);
                onLoad(plugin);
            }
        } catch (Exception e) {
            ErrorLogger.generateErrorLog(e);
        }

    }
Ejemplo n.º 8
0
 /**
  * This calculateLocation method varies the location of the image and this occurs with the arrays;
  * the min.value and location are used.
  */
 public void calculateLocation() {
   try {
     if (location[3] != Integer.MIN_VALUE) {
       int[] frameLoc = GameRunner.getFrameLoc();
       location[2] = location[0] - frameLoc[0];
       location[3] = location[1] - frameLoc[1];
     }
   } catch (Exception e) {
     ErrorLogger.logError("Can't calculate object location " + e);
   }
 }
Ejemplo n.º 9
0
 /**
  * Deletes specific user from database, user is foundby provided email.
  *
  * @param email <code>String</code> type alue of email
  * @return <code>boolean</code> type value true if user is successfully deleted, false if not
  */
 public static boolean deleteUser(String email) {
   AppUser user = AppUser.getUserByEmail(email);
   if (user != null) {
     try {
       user.delete();
       return true;
     } catch (PersistenceException e) {
       ErrorLogger.createNewErrorLogger("Failed to delete user.", e.getMessage());
       return false;
     }
   }
   return false;
 }
Ejemplo n.º 10
0
  private static int getSubSurfaceFrame(String SymbolID, int fillCode, int symStd) {
    int returnVal = 0;

    returnVal = 831;

    try {
      // Special check for sea mine graphics
      // 2525C///////////////////////////////////////////////////////////////
      if (RendererSettings.getInstance().getSymbologyStandard()
          == RendererSettings.Symbology_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;
        } //
      } else // 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).equalsIgnoreCase("S*U*ND----*****")) {
          returnVal = -1;
        } //
        else if (SymbolUtilities.getBasicSymbolID(SymbolID).equalsIgnoreCase("S*U*X-----*****")) {
          returnVal = -1;
        } else {
          if (SymbolID.charAt(3) == 'A' || SymbolID.charAt(3) == 'a') return fillCode + 2;
          else return fillCode + 1;
        }
      }
    } catch (Exception exc) {
      ErrorLogger.LogException("UnitFontLookupC", "getSubSurfaceFrame", exc);
      return fillCode;
    }

    return returnVal;
  }
Ejemplo n.º 11
0
  /**
   * Creates an outline of a text shape for better readability
   *
   * @param originalText
   * @param outlineSize desired width of the outline. Overrides the value in the RendererSettings
   *     object.
   * @return
   */
  public static ShapeInfo createTextOutline(ShapeInfo originalText, int outlineSize) {
    Shape outline = null;
    ShapeInfo siOutline = null;

    // int outlineSize = RendererSettings.getInstance().getTextOutlineWidth();

    outlineSize = Math.abs(outlineSize);

    Color textColor = null;

    try {
      if (originalText.getShape() != null) outline = new GeneralPath(originalText.getShape());
      else if (originalText.getTextLayout() != null) {
        outline =
            originalText
                .getTextLayout()
                .getOutline(
                    AffineTransform.getTranslateInstance(
                        originalText.getGlyphPosition().getX(),
                        originalText.getGlyphPosition().getY()));
      }
      siOutline = new ShapeInfo(outline);

      if (originalText.getFillColor() != null) textColor = originalText.getFillColor(); // shape
      else if (originalText.getLineColor() != null) // vs
      textColor = originalText.getLineColor(); // textlayout

      //            if(textColor.getRed() == 255 &&
      //                    textColor.getGreen() == 255 &&
      //                    textColor.getBlue() == 255)
      //                siOutline.setLineColor(Color.BLACK);
      //            else
      //                siOutline.setLineColor(Color.WHITE);

      if (originalText.getAffineTransform() != null)
        siOutline.setAffineTransform(new AffineTransform(originalText.getAffineTransform()));

      if (originalText.getTextBackgroundColor() != null) {
        siOutline.setLineColor(originalText.getTextBackgroundColor());
      } else siOutline.setLineColor(getIdealTextBackgroundColor(textColor));

      // siOutline.setStroke(new BasicStroke(2));
      siOutline.setStroke(
          new BasicStroke(outlineSize, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 3));
    } catch (Exception exc) {
      ErrorLogger.LogException("SymbolDraw", "createTextOuline", exc);
    }
    return siOutline;
  }
Ejemplo n.º 12
0
  /**
   * @param text
   * @param modifierValue
   * @param x
   * @param y
   * @param textColor Null == Black
   * @param textBackgroundColor null == renderer decides
   * @return
   */
  public static ShapeInfo CreateModifierShapeInfo(
      TextLayout text,
      String modifierValue,
      double x,
      double y,
      Color textColor,
      Color textBackgroundColor) {
    try {
      ShapeInfo si = new ShapeInfo(text, new Point((int) x, (int) y));
      // returnVal.setLineColor(textColor);

      if (textColor == null) textColor = Color.BLACK;

      int textRenderMethod = RendererSettings.getInstance().getTextRenderMethod();

      AffineTransform at = null; // new AffineTransform();

      if (textRenderMethod == RendererSettings.RenderMethod_SHAPES) {
        at = new AffineTransform();
        at.translate(x, y);
        Shape label = text.getOutline(at);
        si = new ShapeInfo(label);
        si.setFillColor(textColor);
      } else if (textRenderMethod == RendererSettings.RenderMethod_NATIVE) {
        si = new ShapeInfo(text, new Point((int) x, (int) y));
        si.setLineColor(textColor);
      }

      // for World Wind which just takes a string and x,y.
      si.setModifierString(modifierValue);
      si.setModifierStringPosition(new Point((int) x, (int) y));

      si.setStroke(new BasicStroke(0, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 3));
      si.setShapeType(ShapeInfo.SHAPE_TYPE_UNIT_DISPLAY_MODIFIER);

      if (textBackgroundColor != null) si.setTextBackgroundColor(textBackgroundColor);

      return si;
    } catch (Exception exc) {
      ErrorLogger.LogException("JavaRenderer", "CreateModifierShapeInfo", exc);
      return null;
    }
  }
Ejemplo n.º 13
0
  /**
   * @param fgColor
   * @return
   */
  public static Color getIdealTextBackgroundColor(Color fgColor) {
    // ErrorLogger.LogMessage("SymbolDraw","getIdealtextBGColor", "in function", Level.SEVERE);
    try {
      // an array of three elements containing the
      // hue, saturation, and brightness (in that order),
      // of the color with the indicated red, green, and blue components/
      float hsbvals[] = new float[3];

      if (fgColor != null) {
          /*
          Color.RGBtoHSB(fgColor.getRed(), fgColor.getGreen(), fgColor.getBlue(), hsbvals);

          if(hsbvals != null)
          {
              //ErrorLogger.LogMessage("SymbolDraw","getIdealtextBGColor", "length: " + String.valueOf(hsbvals.length));
              //ErrorLogger.LogMessage("SymbolDraw","getIdealtextBGColor", "H: " + String.valueOf(hsbvals[0]) + " S: " + String.valueOf(hsbvals[1]) + " B: " + String.valueOf(hsbvals[2]),Level.SEVERE);
              if(hsbvals[2] > 0.6)
                  return Color.BLACK;
              else
                  return Color.WHITE;
          }*/

        int nThreshold =
            RendererSettings.getInstance().getTextBackgroundAutoColorThreshold(); // 160;
        int bgDelta =
            (int)
                ((fgColor.getRed() * 0.299)
                    + (fgColor.getGreen() * 0.587)
                    + (fgColor.getBlue() * 0.114));
        // ErrorLogger.LogMessage("bgDelta: " + String.valueOf(255-bgDelta));
        // if less than threshold, black, otherwise white.
        // return (255 - bgDelta < nThreshold) ? Color.BLACK : Color.WHITE;//new Color(0, 0, 0,
        // fgColor.getAlpha())
        return (255 - bgDelta < nThreshold)
            ? new Color(0, 0, 0, fgColor.getAlpha())
            : new Color(255, 255, 255, fgColor.getAlpha());
      }
    } catch (Exception exc) {
      ErrorLogger.LogException("SymbolDraw", "getIdealtextBGColor", exc);
    }
    return Color.WHITE;
  }
Ejemplo n.º 14
0
 /**
  * Changes role of user, new role is taken from html selection box. User is found with provided
  * email.
  *
  * @param email <code>String</code> type value of user email
  * @param role <code>String</code> type value of new user role
  * @return <code>boolean</code> type value true if user is successfully updated, false if not
  */
 public static boolean changeUserRole(String email, String role) {
   AppUser user = AppUser.getUserByEmail(email);
   if (user != null) {
     if ("buyer".equals(role)) {
       user.userAccessLevel = UserAccessLevel.BUYER;
     } else if ("seller".equals(role)) {
       user.userAccessLevel = UserAccessLevel.SELLER;
     } else if ("hotelmanager".equals(role)) {
       user.userAccessLevel = UserAccessLevel.HOTEL_MANAGER;
     }
     try {
       user.update();
       return true;
     } catch (PersistenceException e) {
       ErrorLogger.createNewErrorLogger("Failed to change user role.", e.getMessage());
       return false;
     }
   }
   return false;
 }
Ejemplo n.º 15
0
 /**
  * Saves new user to database, user is checked for being null value, depending on userType, seller
  * doesn't have to authenticate email address.
  *
  * @param user <code>AppUser</code> type value of user
  * @param userType <code>String</code> type value of user type
  * @return <code>boolean</code> type value if user is successfully saved to database, false if not
  */
 public static boolean saveNewUser(AppUser user, String userType) {
   if (user != null) {
     user.hashPass();
     user.token = UUID.randomUUID().toString();
     user.androidToken = UUID.randomUUID().toString();
     if (Constants.USER_SELLER.equals(userType)) {
       user.userAccessLevel = UserAccessLevel.SELLER;
       user.validated = Constants.VALIDATED_USER;
     }
     try {
       user.save();
       return true;
     } catch (PersistenceException e) {
       ErrorLogger.createNewErrorLogger(
           "Failed to save user. Possible duplicate email entry.", e.getMessage());
       return false;
     }
   }
   return false;
 }
Ejemplo n.º 16
0
  /**
   * Creates a filled rectangle backdrop for the text
   *
   * @param originalText
   * @return
   */
  public static ShapeInfo createTextBackgroundFill(ShapeInfo originalText) {
    Rectangle tempRect = null;
    ShapeInfo background = null;
    ShapeInfo returnVal = null;
    try {
      // tempRect = temp.getBounds();
      tempRect =
          originalText
              .getTextLayout()
              .getPixelBounds(
                  null,
                  (float) originalText.getGlyphPosition().getX(),
                  (float) originalText.getGlyphPosition().getY());
      // tempRect.setRect(temp.getTextLayout().getBounds());
      background =
          new ShapeInfo(
              new Rectangle(
                  tempRect.x - 2, tempRect.y - 2, tempRect.width + 4, tempRect.height + 4));
      if (originalText.getTextBackgroundColor() != null) {
        background.setFillColor(originalText.getTextBackgroundColor());
      } else if (RendererSettings.getInstance().getLabelBackgroundColor() != null) {
        background.setFillColor(RendererSettings.getInstance().getLabelBackgroundColor());
      } else {
        Color bgColor = null;
        if (originalText.getLineColor() != null)
          bgColor = getIdealTextBackgroundColor(originalText.getLineColor());
        else if (originalText.getFillColor() != null)
          bgColor = getIdealTextBackgroundColor(originalText.getFillColor());
        else bgColor = Color.white;

        background.setFillColor(bgColor);
      }

      if (originalText.getAffineTransform() != null)
        background.setAffineTransform(new AffineTransform(originalText.getAffineTransform()));
      returnVal = background;
    } catch (Exception exc) {
      ErrorLogger.LogException("SymbolDraw", "CreateTextBackgroundFill", exc);
    }
    return returnVal;
  }
Ejemplo n.º 17
0
  private static int getSeaSurfaceFill(String SymbolID) {
    char affiliation = 0;
    char status = 0;
    int returnVal = 0;

    try {
      affiliation = SymbolID.charAt(1); // F,H,N,U,etc...
      status = SymbolID.charAt(3); // A,P,C,D,X,F

      if (SymbolUtilities.getBasicSymbolID(SymbolID).equalsIgnoreCase("S*S*O-----*****")) {
        return 2016;
      } else {
        if (affiliation == 'F'
            || affiliation == 'A'
            || affiliation == 'D'
            || affiliation == 'M'
            || affiliation == 'J'
            || affiliation == 'K') {
          return FillIndexFS;
        } else if (affiliation == 'H' || affiliation == 'S') // hostile,suspect
        {
          return FillIndexHS;
        } else if (affiliation == 'N' || affiliation == 'L') // neutral,exercise neutral
        {
          return FillIndexNS;
        } else if (affiliation == 'P'
            || affiliation == 'U'
            || affiliation == 'G'
            || affiliation == 'W') {
          return FillIndexUS;
        }
      }
    } catch (Exception exc) {
      ErrorLogger.LogException("UnitFontLookupC", "getSeaSurfaceFill", exc);
      return FillIndexUG;
    }
    return FillIndexUG;
  }
Ejemplo n.º 18
0
 public static boolean activateForgottenPassword(String email) {
   AppUser user = AppUser.getUserByEmail(email);
   if (user != null) {
     try {
       user.forgottenPassToken = UUID.randomUUID().toString();
       user.update();
       // Sending Email To user
       String host =
           Play.application().configuration().getString("url")
               + "user/forgotyourpassword/"
               + user.forgottenPassToken;
       String cancelRequest =
           Play.application().configuration().getString("url")
               + "user/cancelpasswordchangerequest/"
               + user.forgottenPassToken;
       MailHelper.send(user.email, host, Constants.CHANGE_PASSWORD, cancelRequest, null, null);
       return true;
     } catch (PersistenceException e) {
       ErrorLogger.createNewErrorLogger("Failed to set password reset token.", e.getMessage());
       return false;
     }
   }
   return false;
 }
Ejemplo n.º 19
0
  /** evaluates the operator */
  public OperandToken evaluate(Token[] operands, GlobalValues globals) {
    if (breakHit || continueHit) return null;

    double x1; // minimum
    double x2; // maximum
    double dx = 1; // increment

    if (operands == null) return new Expression(new ColonOperatorToken());

    if ((operands.length < 2) || (operands.length > 3))
      Errors.throwMathLibException("ColonOperator: <2 or >3 arguments");

    if ((operands[0] == null) || (operands[1] == null))
      Errors.throwMathLibException("ColonOperator: argument 1 or 2 is null");

    if (operands.length == 2
        && ((operands[0] instanceof DoubleNumberToken) && (operands[1] instanceof DelimiterToken)))
      return new Expression(
          new ColonOperatorToken(), (OperandToken) operands[0], (OperandToken) operands[1]);

    if (operands.length == 3
        && (operands[0] instanceof DoubleNumberToken)
        && (operands[1] instanceof DoubleNumberToken)
        && (operands[2] instanceof DelimiterToken)) {
      OperandToken[] rettok = new OperandToken[3];
      rettok[0] = (OperandToken) operands[0];
      rettok[1] = (OperandToken) operands[1];
      rettok[2] = (OperandToken) operands[2];
      return new Expression(new ColonOperatorToken(), rettok, 3);
    }

    // get data from arguments
    if (operands.length == 0) {
      return new Expression(new ColonOperatorToken());
    } else if (operands.length == 2) {
      if ((!(operands[0] instanceof DoubleNumberToken))
          || (!(operands[1] instanceof DoubleNumberToken)))
        Errors.throwMathLibException("ColonOperator: argument not number or end (x:x)");

      // e.g. 4:5
      x1 = ((DoubleNumberToken) operands[0]).getReValues()[0][0];
      x2 = ((DoubleNumberToken) operands[1]).getReValues()[0][0];
    } else {
      if (operands[2] == null) return null;
      if ((!(operands[0] instanceof DoubleNumberToken))
          || (!(operands[1] instanceof DoubleNumberToken))
          || (!(operands[2] instanceof DoubleNumberToken)))
        Errors.throwMathLibException("ColonOperator: argument not number or end (x:x:x)");

      // e.g. 4:2:20
      x1 = ((DoubleNumberToken) operands[0]).getReValues()[0][0];
      dx = ((DoubleNumberToken) operands[1]).getReValues()[0][0];
      x2 = ((DoubleNumberToken) operands[2]).getReValues()[0][0];
    }

    ErrorLogger.debugLine("ColonOperator: x1,dx,x2 " + x1 + " " + dx + " " + x2);

    int n = (int) ((x2 - x1) / dx) + 1;
    double[][] values = new double[1][n];
    for (int i = 0; i < n; i++) {
      values[0][i] = x1 + ((double) i) * dx;
    }

    return new DoubleNumberToken(values);
  }
Ejemplo n.º 20
0
  /**
   * Creates an outline for single point graphics
   *
   * @param symbolFrame
   * @param thickness
   * @return
   */
  public static ArrayList<ShapeInfo> createSinglePointOutline(
      ShapeInfo symbolFrame, int thickness, Color outlineColor) {
    ShapeInfo siOutline1 = null;
    ShapeInfo siOutline2 = null;
    ShapeInfo siOutline3 = null;
    ShapeInfo siOutline4 = null;
    ShapeInfo siOutline5 = null;
    ShapeInfo siOutline6 = null;
    ShapeInfo siOutline7 = null;
    ShapeInfo siOutline8 = null;
    AffineTransform afx1 = null;
    AffineTransform afx2 = null;
    AffineTransform afx3 = null;
    AffineTransform afx4 = null;
    AffineTransform afx5 = null;
    AffineTransform afx6 = null;
    AffineTransform afx7 = null;
    AffineTransform afx8 = null;
    ArrayList<ShapeInfo> outlineShapes = null;
    // int outlineSize = RendererSettings.getInstance().getTextOutlineWidth();

    Color lineColor = null;
    Color backgroundColor = null;

    try {
      int offset = 0;

      if (outlineColor == null) {
        backgroundColor = getIdealTextBackgroundColor(lineColor);
      } else {
        backgroundColor = outlineColor;
      }
      outlineShapes = new ArrayList<ShapeInfo>();

      if (symbolFrame.getTextLayout() != null) {
        outlineShapes = new ArrayList<ShapeInfo>();

        for (int i = 1; i <= thickness; i++) {

          offset = i;

          Point2D textPosition = null;
          if (symbolFrame.getModifierStringPosition() != null)
            textPosition =
                new Point2D.Double(
                    symbolFrame.getModifierStringPosition().getX(),
                    symbolFrame.getModifierStringPosition().getY());
          else textPosition = new Point2D.Double(0, 0);

          siOutline1 =
              new ShapeInfo(
                  symbolFrame.getTextLayout(),
                  new Point2D.Double(textPosition.getX() - offset, textPosition.getY() - offset));
          siOutline2 =
              new ShapeInfo(
                  symbolFrame.getTextLayout(),
                  new Point2D.Double(textPosition.getX() + offset, textPosition.getY() - offset));
          siOutline3 =
              new ShapeInfo(
                  symbolFrame.getTextLayout(),
                  new Point2D.Double(textPosition.getX() - offset, textPosition.getY() + offset));
          siOutline4 =
              new ShapeInfo(
                  symbolFrame.getTextLayout(),
                  new Point2D.Double(textPosition.getX() + offset, textPosition.getY() + offset));
          siOutline5 =
              new ShapeInfo(
                  symbolFrame.getTextLayout(),
                  new Point2D.Double(textPosition.getX() - offset, textPosition.getY()));
          siOutline6 =
              new ShapeInfo(
                  symbolFrame.getTextLayout(),
                  new Point2D.Double(textPosition.getX() + offset, textPosition.getY()));
          siOutline7 =
              new ShapeInfo(
                  symbolFrame.getTextLayout(),
                  new Point2D.Double(textPosition.getX(), textPosition.getY() + offset));
          siOutline8 =
              new ShapeInfo(
                  symbolFrame.getTextLayout(),
                  new Point2D.Double(textPosition.getX(), textPosition.getY() - offset));

          siOutline1.setLineColor(backgroundColor);
          siOutline2.setLineColor(backgroundColor);
          siOutline3.setLineColor(backgroundColor);
          siOutline4.setLineColor(backgroundColor);
          siOutline5.setLineColor(backgroundColor);
          siOutline6.setLineColor(backgroundColor);
          siOutline7.setLineColor(backgroundColor);
          siOutline8.setLineColor(backgroundColor);

          Stroke tempStroke = new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 3);
          siOutline1.setStroke(tempStroke);
          siOutline2.setStroke(tempStroke);
          siOutline3.setStroke(tempStroke);
          siOutline4.setStroke(tempStroke);
          siOutline5.setStroke(tempStroke);
          siOutline6.setStroke(tempStroke);
          siOutline7.setStroke(tempStroke);
          siOutline8.setStroke(tempStroke);

          if (symbolFrame.getAffineTransform() != null) {
            siOutline1.setAffineTransform(new AffineTransform(symbolFrame.getAffineTransform()));
            siOutline2.setAffineTransform(new AffineTransform(symbolFrame.getAffineTransform()));
            siOutline3.setAffineTransform(new AffineTransform(symbolFrame.getAffineTransform()));
            siOutline4.setAffineTransform(new AffineTransform(symbolFrame.getAffineTransform()));
            siOutline5.setAffineTransform(new AffineTransform(symbolFrame.getAffineTransform()));
            siOutline6.setAffineTransform(new AffineTransform(symbolFrame.getAffineTransform()));
            siOutline7.setAffineTransform(new AffineTransform(symbolFrame.getAffineTransform()));
            siOutline8.setAffineTransform(new AffineTransform(symbolFrame.getAffineTransform()));
          }

          outlineShapes.add(siOutline1);
          outlineShapes.add(siOutline2);
          outlineShapes.add(siOutline3);
          outlineShapes.add(siOutline4);
          outlineShapes.add(siOutline5);
          outlineShapes.add(siOutline6);
          outlineShapes.add(siOutline7);
          outlineShapes.add(siOutline8);
        } // end for
      } // end if
      else if (symbolFrame.getGlyphVector() != null) {
        outlineShapes = new ArrayList<ShapeInfo>();

        for (int j = 1; j <= thickness; j++) {

          offset = j;

          Point2D textPosition =
              new Point2D.Double(
                  symbolFrame.getGlyphPosition().getX(), symbolFrame.getGlyphPosition().getY());

          siOutline1 =
              new ShapeInfo(
                  symbolFrame.getGlyphVector(),
                  new Point2D.Double(textPosition.getX() - offset, textPosition.getY() - offset));
          siOutline2 =
              new ShapeInfo(
                  symbolFrame.getGlyphVector(),
                  new Point2D.Double(textPosition.getX() + offset, textPosition.getY() - offset));
          siOutline3 =
              new ShapeInfo(
                  symbolFrame.getGlyphVector(),
                  new Point2D.Double(textPosition.getX() - offset, textPosition.getY() + offset));
          siOutline4 =
              new ShapeInfo(
                  symbolFrame.getGlyphVector(),
                  new Point2D.Double(textPosition.getX() + offset, textPosition.getY() + offset));
          siOutline5 =
              new ShapeInfo(
                  symbolFrame.getGlyphVector(),
                  new Point2D.Double(textPosition.getX() - offset, textPosition.getY()));
          siOutline6 =
              new ShapeInfo(
                  symbolFrame.getGlyphVector(),
                  new Point2D.Double(textPosition.getX() + offset, textPosition.getY()));
          siOutline7 =
              new ShapeInfo(
                  symbolFrame.getGlyphVector(),
                  new Point2D.Double(textPosition.getX(), textPosition.getY() + offset));
          siOutline8 =
              new ShapeInfo(
                  symbolFrame.getGlyphVector(),
                  new Point2D.Double(textPosition.getX(), textPosition.getY() - offset));

          if (symbolFrame.getShapeType() == ShapeInfo.SHAPE_TYPE_TG_SP_FRAME) {
            siOutline1.setShapeType(ShapeInfo.SHAPE_TYPE_TG_SP_OUTLINE);
            siOutline2.setShapeType(ShapeInfo.SHAPE_TYPE_TG_SP_OUTLINE);
            siOutline3.setShapeType(ShapeInfo.SHAPE_TYPE_TG_SP_OUTLINE);
            siOutline4.setShapeType(ShapeInfo.SHAPE_TYPE_TG_SP_OUTLINE);
            siOutline5.setShapeType(ShapeInfo.SHAPE_TYPE_TG_SP_OUTLINE);
            siOutline6.setShapeType(ShapeInfo.SHAPE_TYPE_TG_SP_OUTLINE);
            siOutline7.setShapeType(ShapeInfo.SHAPE_TYPE_TG_SP_OUTLINE);
            siOutline8.setShapeType(ShapeInfo.SHAPE_TYPE_TG_SP_OUTLINE);
          }

          siOutline1.setLineColor(backgroundColor);
          siOutline2.setLineColor(backgroundColor);
          siOutline3.setLineColor(backgroundColor);
          siOutline4.setLineColor(backgroundColor);
          siOutline5.setLineColor(backgroundColor);
          siOutline6.setLineColor(backgroundColor);
          siOutline7.setLineColor(backgroundColor);
          siOutline8.setLineColor(backgroundColor);

          Stroke tempStroke = new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 3);
          siOutline1.setStroke(tempStroke);
          siOutline2.setStroke(tempStroke);
          siOutline3.setStroke(tempStroke);
          siOutline4.setStroke(tempStroke);
          siOutline5.setStroke(tempStroke);
          siOutline6.setStroke(tempStroke);
          siOutline7.setStroke(tempStroke);
          siOutline8.setStroke(tempStroke);

          if (symbolFrame.getAffineTransform() != null) {
            siOutline1.setAffineTransform(new AffineTransform(symbolFrame.getAffineTransform()));
            siOutline2.setAffineTransform(new AffineTransform(symbolFrame.getAffineTransform()));
            siOutline3.setAffineTransform(new AffineTransform(symbolFrame.getAffineTransform()));
            siOutline4.setAffineTransform(new AffineTransform(symbolFrame.getAffineTransform()));
            siOutline5.setAffineTransform(new AffineTransform(symbolFrame.getAffineTransform()));
            siOutline6.setAffineTransform(new AffineTransform(symbolFrame.getAffineTransform()));
            siOutline7.setAffineTransform(new AffineTransform(symbolFrame.getAffineTransform()));
            siOutline8.setAffineTransform(new AffineTransform(symbolFrame.getAffineTransform()));
          }

          outlineShapes.add(siOutline1);
          outlineShapes.add(siOutline2);
          outlineShapes.add(siOutline3);
          outlineShapes.add(siOutline4);
          outlineShapes.add(siOutline5);
          outlineShapes.add(siOutline6);
          outlineShapes.add(siOutline7);
          outlineShapes.add(siOutline8);
        } // end for

      } else if (symbolFrame.getShape() != null) {
        outlineShapes = new ArrayList<ShapeInfo>();

        for (int k = 1; k <= thickness; k++) {

          offset = k;

          siOutline1 =
              new ShapeInfo(symbolFrame.getShape(), ShapeInfo.SHAPE_TYPE_SINGLE_POINT_OUTLINE);
          siOutline2 =
              new ShapeInfo(symbolFrame.getShape(), ShapeInfo.SHAPE_TYPE_SINGLE_POINT_OUTLINE);
          siOutline3 =
              new ShapeInfo(symbolFrame.getShape(), ShapeInfo.SHAPE_TYPE_SINGLE_POINT_OUTLINE);
          siOutline4 =
              new ShapeInfo(symbolFrame.getShape(), ShapeInfo.SHAPE_TYPE_SINGLE_POINT_OUTLINE);
          siOutline5 =
              new ShapeInfo(symbolFrame.getShape(), ShapeInfo.SHAPE_TYPE_SINGLE_POINT_OUTLINE);
          siOutline6 =
              new ShapeInfo(symbolFrame.getShape(), ShapeInfo.SHAPE_TYPE_SINGLE_POINT_OUTLINE);
          siOutline7 =
              new ShapeInfo(symbolFrame.getShape(), ShapeInfo.SHAPE_TYPE_SINGLE_POINT_OUTLINE);
          siOutline8 =
              new ShapeInfo(symbolFrame.getShape(), ShapeInfo.SHAPE_TYPE_SINGLE_POINT_OUTLINE);

          siOutline1.setLineColor(backgroundColor);
          siOutline2.setLineColor(backgroundColor);
          siOutline3.setLineColor(backgroundColor);
          siOutline4.setLineColor(backgroundColor);
          siOutline5.setLineColor(backgroundColor);
          siOutline6.setLineColor(backgroundColor);
          siOutline7.setLineColor(backgroundColor);
          siOutline8.setLineColor(backgroundColor);

          Stroke tempStroke = new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 3);
          siOutline1.setStroke(tempStroke);
          siOutline2.setStroke(tempStroke);
          siOutline3.setStroke(tempStroke);
          siOutline4.setStroke(tempStroke);
          siOutline5.setStroke(tempStroke);
          siOutline6.setStroke(tempStroke);
          siOutline7.setStroke(tempStroke);
          siOutline8.setStroke(tempStroke);

          if (symbolFrame.getAffineTransform() == null) {
            afx1 = new AffineTransform();
            afx2 = new AffineTransform();
            afx3 = new AffineTransform();
            afx4 = new AffineTransform();
            afx5 = new AffineTransform();
            afx6 = new AffineTransform();
            afx7 = new AffineTransform();
            afx8 = new AffineTransform();
          } else {
            afx1 = new AffineTransform(symbolFrame.getAffineTransform());
            afx2 = new AffineTransform(symbolFrame.getAffineTransform());
            afx3 = new AffineTransform(symbolFrame.getAffineTransform());
            afx4 = new AffineTransform(symbolFrame.getAffineTransform());
            afx5 = new AffineTransform(symbolFrame.getAffineTransform());
            afx6 = new AffineTransform(symbolFrame.getAffineTransform());
            afx7 = new AffineTransform(symbolFrame.getAffineTransform());
            afx8 = new AffineTransform(symbolFrame.getAffineTransform());
          }

          afx1.translate(-offset, -offset);
          afx2.translate(+offset, -offset);
          afx3.translate(-offset, +offset);
          afx4.translate(+offset, +offset);
          afx5.translate(-offset, 0);
          afx6.translate(+offset, 0);
          afx7.translate(0, +offset);
          afx8.translate(0, -offset);

          siOutline1.setAffineTransform(afx1);
          siOutline2.setAffineTransform(afx2);
          siOutline3.setAffineTransform(afx3);
          siOutline4.setAffineTransform(afx4);
          siOutline5.setAffineTransform(afx5);
          siOutline6.setAffineTransform(afx6);
          siOutline7.setAffineTransform(afx7);
          siOutline8.setAffineTransform(afx8);

          outlineShapes.add(siOutline1);
          outlineShapes.add(siOutline2);
          outlineShapes.add(siOutline3);
          outlineShapes.add(siOutline4);
          outlineShapes.add(siOutline5);
          outlineShapes.add(siOutline6);
          outlineShapes.add(siOutline7);
          outlineShapes.add(siOutline8);
        } // end for

      } else {
        String message = "ShapeInfo wasn't a TextLayout or a GlyphVector, returning null";
        ErrorLogger.LogMessage("SymbolDraw", "createTextOutlineQuick()", message, Level.FINEST);
        return null;
      }

      return outlineShapes;
    } catch (Exception exc) {
      ErrorLogger.LogException("SymbolDraw", "createTextOuline", exc);
    }
    return null;
  }
Ejemplo n.º 21
0
  private static int getSubSurfaceFill(String SymbolID, int symStd) {
    char affiliation = 0;
    char status = 0;
    int returnVal = 0;

    returnVal = 831;

    try {
      affiliation = SymbolID.charAt(1); // F,H,N,U,etc...
      status = SymbolID.charAt(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
      }

      // appears in USAS so we check in both standards
      if (SymbolUtilities.getBasicSymbolID(SymbolID).equalsIgnoreCase("S*U*X-----*****")) {
        if (status == 'A') returnVal = returnVal + 2;
        else returnVal++;
      }

      // Special check for sea mine graphics
      // 2525C///////////////////////////////////////////////////////////////
      if (symStd == RendererSettings.Symbology_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-----*****")) {
          returnVal++;

          if (status == 'A') returnVal++;

        } else if (SymbolUtilities.getBasicSymbolID(SymbolID).equalsIgnoreCase("S*U*ND----*****")) {
          returnVal = 2121;
        }
      } else // 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).equalsIgnoreCase("S*U*ND----*****")) {
          returnVal = 2121;
        } //
      }
    } catch (Exception exc) {
      ErrorLogger.LogException("UnitFontLookupC", "getSubSurfaceFill", exc);
      return FillIndexUU;
    }

    return returnVal;
  }
Ejemplo n.º 22
0
  public SampledGraphProjection<SocialSparseGraph, SocialSparseVertex, SocialSparseEdge> buildGraph(
      List<String> alterTables, List<String> egoTables, List<String> sqlDumps) throws IOException {
    errLogger = new ErrorLogger();
    /*
     * Load raw data.
     */
    AlterTableReader alterReader = new AlterTableReader(alterTables);
    EgoTableReader egoReader = new EgoTableReader(egoTables);
    SQLDumpReader sqlReader = new SQLDumpReader(sqlDumps);
    /*
     * Build the raw graph and a sampled projection.
     */
    graph = builder.createGraph();
    proj = projBuilder.createGraph(graph);
    /*
     * Create the vertices.
     */
    projMap = new HashMap<SocialSparseVertex, SampledVertexDecorator<SocialSparseVertex>>();
    idMap = new HashMap<String, SocialSparseVertex>();

    for (Entry<String, VertexRecord> entry : alterReader.getVertices().entrySet()) {
      VertexRecord vRecord = entry.getValue();
      /*
       * Extract the home location.
       */
      Point point;
      if (vRecord.isEgo) {
        point = sqlReader.getEgoLocation(vRecord.egoSQLId);
        if (point == null) {
          /*
           * try getting coordinates via google
           */
          logger.info("Requesting google server for coordinates.");
          point = egoReader.getEgoLocation(vRecord.id);
        }
      } else {
        point = sqlReader.getAlterLocation(vRecord.alterKeys);
      }
      if (point == null) {
        errLogger.logNoCoordinate(vRecord.isEgo);
        //				point = geoFacotry.createPoint(new Coordinate(0, 0));
      }
      /*
       * Create a vertex and its projection.
       */
      SocialSparseVertex vertex = builder.addVertex(graph, createPerson(vRecord, sqlReader), point);
      SampledVertexDecorator<SocialSparseVertex> vProj = projBuilder.addVertex(proj, vertex);
      /*
       * If it is an ego set the snowball attributes.
       */
      if (vRecord.isEgo) {
        vProj.sample(infereIterationSampled(new Integer(vRecord.id)));
        vProj.detect(vProj.getIterationSampled() - 1);
      }

      projMap.put(vertex, vProj);
      idMap.put(vRecord.id, vertex);
      //			recordMap.put(vRecord.id, vRecord);
    }
    /*
     * Create the edges.
     */
    for (Tuple<VertexRecord, VertexRecord> edge : alterReader.getEdges()) {
      SocialSparseVertex v1 = idMap.get(edge.getFirst().id);
      SocialSparseVertex v2 = idMap.get(edge.getSecond().id);
      SocialSparseEdge socialEdge = builder.addEdge(graph, v1, v2);
      /*
       * Check if we have double edges.
       */
      if (socialEdge != null) {
        SampledVertexDecorator<SocialSparseVertex> vProj1 = projMap.get(v1);
        SampledVertexDecorator<SocialSparseVertex> vProj2 = projMap.get(v2);

        projBuilder.addEdge(proj, vProj1, vProj2, socialEdge);
        /*
         * Set the snowball attributes if it is not an ego.
         */
        if (!vProj1.isSampled()) {
          if (vProj1.isDetected())
            /*
             * If this vertex is already detected check if the adjacent vertex has been sampled earlier.
             */
            vProj1.detect(Math.min(vProj1.getIterationDetected(), vProj2.getIterationSampled()));
          else vProj1.detect(vProj2.getIterationSampled());
        }

        if (!vProj2.isSampled()) {
          if (vProj2.isDetected())
            /*
             * If this vertex is already detected check if the adjacent vertex has been sampled earlier.
             */
            vProj2.detect(Math.min(vProj2.getIterationDetected(), vProj1.getIterationSampled()));
          else vProj2.detect(vProj1.getIterationSampled());
        }
        /*
         * add edge attributes
         */
        VertexRecord rec1 = edge.getFirst();
        VertexRecord rec2 = edge.getSecond();
        double freq = 0;
        if (rec1.isEgo) {
          freq = sqlReader.getF2FFrequencey(rec1.egoSQLId, rec2.alterKeys.get(rec1.egoSQLId));
        } else {
          freq = sqlReader.getF2FFrequencey(rec2.egoSQLId, rec1.alterKeys.get(rec2.egoSQLId));
        }
        socialEdge.setFrequency(freq);

        socialEdge.setType(sqlReader.getEdgeType(rec1, rec2));

      } else {
        errLogger.logDoubleEdge();
      }
    }
    /*
     * Sociogram
     */
    loadSociogramData(alterReader.getVertices().values(), sqlReader);

    logger.info(errLogger.toString());
    return proj;
  }
Ejemplo n.º 23
0
  /**
   * 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 symStd) {
    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() >= 10) {
        scheme = SymbolID.charAt(0); // S,O,E,I,etc...
        affiliation = SymbolID.charAt(1); // F,H,N,U,etc...
        battleDimension = SymbolID.charAt(2); // P,A,G,S,U,F,X,Z
        status = SymbolID.charAt(3); // A,P,C,D,X,F
        grdtrkSubset = SymbolID.charAt(4);

        if (scheme == 'S') // Warfighting symbols
        {
          if (affiliation == 'F'
              || affiliation == 'A'
              || affiliation == 'D'
              || affiliation == 'M'
              || affiliation == 'J'
              || affiliation == 'K') {

            if (battleDimension == 'F' || battleDimension == 'G') // ground & SOF
            {
              if (battleDimension == 'F'
                  || (battleDimension == 'G'
                      && (grdtrkSubset == 'U'
                          || grdtrkSubset == 'I'
                          || grdtrkSubset == '0'
                          || grdtrkSubset == '-'))) {
                returnVal = 803;
              } else if (battleDimension == 'G' && grdtrkSubset == 'E') {
                returnVal = 812;
              } else returnVal = 803;
            } else if (battleDimension == 'A') // Air
            {
              returnVal = 819;
            } else if (battleDimension == 'S') // SeaSurface
            {
              returnVal = getSeaSurfaceFill(SymbolID);
            } else if (battleDimension == 'U') // Subsurface
            {
              returnVal = getSubSurfaceFill(SymbolID, symStd);
            } else if (battleDimension == 'P') // space
            {
              returnVal = 843;
            } else // if(battleDimension=='Z')//unknown
            {
              returnVal = 812; // index in font file
            }
          } else if (affiliation == 'H' || affiliation == 'S') // hostile,suspect
          {
            if (battleDimension == 'F' || battleDimension == 'G') // ground & SOF
            {
              returnVal = 806;
            } else if (battleDimension == 'A') // Air
            {
              returnVal = 816;
            } else if (battleDimension == 'S') // SeaSurface
            {
              returnVal = getSeaSurfaceFill(SymbolID);
            } else if (battleDimension == 'U') // Subsurface
            {
              returnVal = getSubSurfaceFill(SymbolID, symStd);
            } else if (battleDimension == 'P') // space
            {
              returnVal = 840;
            } else // if(battleDimension=='Z')//unknown
            {
              returnVal = 806; // index in font file
            }
          } else if (affiliation == 'N' || affiliation == 'L') // neutral,exercise neutral
          {
            if (battleDimension == 'F' || battleDimension == 'G') // ground & SOF
            {
              returnVal = 809;
            } else if (battleDimension == 'A') // Air
            {
              returnVal = 822;
            } else if (battleDimension == 'S') // SeaSurface
            {
              returnVal = getSeaSurfaceFill(SymbolID);
            } else if (battleDimension == 'U') // Subsurface
            {
              returnVal = getSubSurfaceFill(SymbolID, symStd);
            } else if (battleDimension == 'P') // space
            {
              returnVal = 846;
            } else // if(battleDimension=='Z')//unknown
            {
              returnVal = 809; // index in font file
            }
          } else if (affiliation == 'P'
              || affiliation == 'U'
              || affiliation == 'G'
              || affiliation == 'W') {

            if (battleDimension == 'Z'
                || // unknown
                battleDimension == 'G'
                || // ground
                battleDimension == 'F') // SOF
            {
              returnVal = 800; // index in font file
            } else if (battleDimension == 'A') // Air
            {
              returnVal = 825;
            } else if (battleDimension == 'S') // SeaSurface
            {
              returnVal = getSeaSurfaceFill(SymbolID);
            } else if (battleDimension == 'U') // Subsurface
            {
              returnVal = getSubSurfaceFill(SymbolID, symStd);
            } else if (battleDimension == 'P') // space
            {
              returnVal = 849;
            } else returnVal = 800;
          } else returnVal = FillIndexUG;
        } // end if scheme == 's'
        else if (scheme == 'E') // Emergency Management Symbols
        {
          if (battleDimension != 'N') // if not EMS natural event
          {
            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 returnVal = 803;
            } 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
            }
          } else // natural events do not have a fill/frame
          {
            returnVal = -1;
          }
        } // 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') {
            if (SymbolID.startsWith("OFI") && SymbolID.substring(4, 10).equals("T-----")) {
              // friendly tent is the ONE STBOPS that draws like equipment.
              returnVal = FillIndexFGE;
            } else {
              returnVal = 803;
            }
          } 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

      } else {
        returnVal = 800;
      }

    } catch (Exception exc) {
      ErrorLogger.LogException("UnitFontLookup", "getFillCode", exc, Level.SEVERE);
    }

    return returnVal + 57000;
  }