/** * Converts a region's location coordinates with the {@code from} * coordinates type to the {@code to} coordinates type. * * @param region The region which location's coordinates needs to be * converted. * @param from The current coordinates type for {@code region}. * @param to The target coordinates type for {@code region}. * @return A new region which is the transformation of {@code region} to * the {@code to} coordinates type. */ protected Region convertRegionLocation(Region region, CoordinatesType from, CoordinatesType to) { ArgumentGuard.notNull(region, "region"); if (region.isEmpty()) { return new Region(region); } ArgumentGuard.notNull(from, "from"); ArgumentGuard.notNull(to, "to"); Location updatedLocation = convertLocation(region.getLocation(), from, to); return new Region(updatedLocation, region.getSize()); } }
/** * Converts a region's location coordinates with the {@code from} * coordinates type to the {@code to} coordinates type. * @param region The region which location's coordinates needs to be converted. * @param from The current coordinates type for {@code region}. * @param to The target coordinates type for {@code region}. * @return A new region which is the transformation of {@code region} to * the {@code to} coordinates type. */ public Region convertRegionLocation(Region region, CoordinatesType from, CoordinatesType to) { ArgumentGuard.notNull(region, "region"); if (region.isSizeEmpty()) { return new Region(region); } ArgumentGuard.notNull(from, "from"); ArgumentGuard.notNull(to, "to"); Location originalLocation = region.getLocation(); logger.verbose("original location: " + originalLocation); Location updatedLocation = convertLocation(originalLocation, from, to); logger.verbose("updated location: " + updatedLocation); return new Region(updatedLocation, region.getSize()); } }
/** * Converts a region's location coordinates with the {@code from} * coordinates type to the {@code to} coordinates type. * @param region The region which location's coordinates needs to be converted. * @param from The current coordinates type for {@code region}. * @param to The target coordinates type for {@code region}. * @return A new region which is the transformation of {@code region} to * the {@code to} coordinates type. */ public Region convertRegionLocation(Region region, CoordinatesType from, CoordinatesType to) { ArgumentGuard.notNull(region, "region"); if (region.isSizeEmpty()) { return new Region(region); } ArgumentGuard.notNull(from, "from"); ArgumentGuard.notNull(to, "to"); Location originalLocation = region.getLocation(); logger.verbose("original location: " + originalLocation); Location updatedLocation = convertLocation(originalLocation, from, to); logger.verbose("updated location: " + updatedLocation); return new Region(updatedLocation, region.getSize()); } }