示例#1
0
 /** Removes all @import statements for css. */
 private String removeImportStatements(final String content) {
   final Matcher m = PATTERN.matcher(content);
   final StringBuffer sb = new StringBuffer();
   while (m.find()) {
     // add and check if already exist
     m.appendReplacement(sb, "");
   }
   m.appendTail(sb);
   return sb.toString();
 }
  @Override
  public DecodeQualification getDecodeQualification(Object input) {
    SystemUtils.LOG.fine("Getting decoders...");

    DecodeQualification decodeQualification = DecodeQualification.UNABLE;

    if (input instanceof File) {
      File file = (File) input;

      if (file.isFile()) {
        String fileName = file.getName();

        // first check it is a Sentinel-2 product
        Matcher matcher = PATTERN.matcher(fileName);
        if (matcher.matches()) {

          // test for granule filename first as it is more restrictive
          if (S2OrthoGranuleMetadataFilename.isGranuleFilename(fileName)) {
            level = matcher.group(4).substring(0, 3);
            S2OrthoGranuleMetadataFilename granuleMetadataFilename =
                S2OrthoGranuleMetadataFilename.create(fileName);
            if (granuleMetadataFilename != null
                && (level.equals("L1C")
                    || (level.equals("L2A")
                        && !this.getClass().equals(S2OrthoProductReaderPlugIn.class)))) {
              String tileId = granuleMetadataFilename.tileNumber;
              String epsg = tileIdentifierToEPSG(tileId);
              if (getEPSG() != null && getEPSG().equalsIgnoreCase(epsg)) {
                decodeQualification = DecodeQualification.INTENDED;
              }
            }
          } else if (S2ProductFilename.isMetadataFilename(fileName)) {
            level = matcher.group(4).substring(3);
            S2ProductFilename productFilename = S2ProductFilename.create(fileName);
            if (productFilename != null) {
              if (level.equals("L1C")
                  ||
                  // no multi-resolution for L2A products
                  (level.equals("L2A")
                      && (this instanceof S2OrthoProduct10MReaderPlugIn
                          || this instanceof S2OrthoProduct20MReaderPlugIn
                          || this instanceof S2OrthoProduct60MReaderPlugIn))) {
                crsCache.ensureIsCached(file.getAbsolutePath());
                if (getEPSG() != null && crsCache.hasEPSG(file.getAbsolutePath(), getEPSG())) {
                  decodeQualification = DecodeQualification.INTENDED;
                }
              }
            }
          }
        }
      }
    }

    return decodeQualification;
  }
示例#3
0
 /** Opposite of {@link #toString()}. */
 public static Area parse(String s) {
   Matcher m = PATTERN.matcher(s);
   if (m.matches()) return new Area(Integer.parseInt(m.group(1)), Integer.parseInt(m.group(2)));
   return null;
 }