/** * Used to inform if Vcard can be used. * * @return True if the address has data in street, zipcode and city, otherwise false. */ public boolean getHasVcardData() { if (StringUtil.isEmpty(street) || StringUtil.isEmpty(zipCode.getZipCode()) || StringUtil.isEmpty(city)) { return false; } return true; }
/** * @inheritDoc * @return True if the address is empty. */ @Override public boolean isEmpty() { boolean empty = true; empty &= StringUtil.isEmpty(street); empty &= StringUtil.isEmpty(zipCode.getZipCode()); empty &= StringUtil.isEmpty(city); if (additionalInfo != null && additionalInfo.size() > 0) { for (int i = 0; i < additionalInfo.size(); i++) { empty &= StringUtil.isEmpty(additionalInfo.get(i)); } } return empty; }
/** * Geocode an address to WGS84. * * @param hsaStreetAddress The street address. * @param googleKey The Google Maps key to use. * @return An array of WGS84 coordinates. */ public double[] geocodeToWGS84FromHsaAddress(Address hsaStreetAddress, String googleKey) { logger.debug(CLASS_NAME + ".geocodeToWGS84()"); // We can't do anything if we don't have at least a street name, zip code or city. if (hsaStreetAddress == null || StringUtil.isEmpty(hsaStreetAddress.getStreet()) && StringUtil.isEmpty(hsaStreetAddress.getZipCode().getZipCode()) && StringUtil.isEmpty(hsaStreetAddress.getCity())) { return null; } String address = hsaStreetAddress.getStreet().trim() + ", " + hsaStreetAddress.getZipCode().getFormattedZipCode().toString().trim() + " " + hsaStreetAddress.getCity().trim() + ", sweden"; return this.geocodeToWGS84FromString(address, googleKey, GeoAddressAccuracy.STREET_LEVEL); }
/** * @param rt90String HSA formatted RT90 coords: X: 1234567, Y: 1234567. * @return An array of RT90 coordinates. */ public static int[] parseRT90HsaString(String rt90String) { int[] result = null; if (!StringUtil.isEmpty(rt90String)) { if (rt90String.indexOf("X:") >= 0 && rt90String.indexOf("Y:") >= 0) { int rt90X = Integer.parseInt(rt90String.substring(3, 10)); int rt90Y = Integer.parseInt(rt90String.substring(15)); result = new int[] {rt90X, rt90Y}; } } return result; }