org.geotools.util.factory.Hints.removeSystemDefault()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中org.geotools.util.factory.Hints.removeSystemDefault()方法的一些代码示例,展示了Hints.removeSystemDefault()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hints.removeSystemDefault()方法的具体详情如下:
包路径:org.geotools.util.factory.Hints
类名称:Hints
方法名:removeSystemDefault

Hints.removeSystemDefault介绍

[英]Removes the specified hints from the set of GeoTools#getDefaultHints.
[中]从GeoTools#GetDefaultHits集合中删除指定的提示。

代码示例

代码示例来源:origin: geotools/geotools

@After
public void tearDown() {
  TimeZone.setDefault(systemTimeZone);
  Hints.removeSystemDefault(Hints.LOCAL_DATE_TIME_HANDLING);
}

代码示例来源:origin: geotools/geotools

protected void tearDownInternal() throws Exception {
  System.clearProperty("org.geotools.referencing.forceXY");
  Hints.removeSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER);
  CRS.reset("all");
}

代码示例来源:origin: geotools/geotools

@AfterClass
public static void tearDown() {
  Hints.removeSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER);
}

代码示例来源:origin: geotools/geotools

@AfterClass
public static void tearDown() {
  Hints.removeSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER);
}

代码示例来源:origin: geotools/geotools

public void testSRSAxisOrder2() throws Exception {
  try {
    Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
    CoordinateReferenceSystem crsEN = CRS.decode("EPSG:4326");
    assertEquals(AxisOrder.EAST_NORTH, CRS.getAxisOrder(crsEN));
    CoordinateReferenceSystem crsNE = CRS.decode("urn:ogc:def:crs:EPSG::4326");
    assertEquals(AxisOrder.NORTH_EAST, CRS.getAxisOrder(crsNE));
  } finally {
    Hints.removeSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER);
  }
}

代码示例来源:origin: geotools/geotools

public void testSRSAxisOrder() throws Exception {
  try {
    CoordinateReferenceSystem crs = CRS.decode("EPSG:4326");
    assertEquals("EPSG:4326", CRS.toSRS(crs));
    Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
    CRS.reset("ALL");
    assertEquals("urn:ogc:def:crs:EPSG::4326", CRS.toSRS(crs));
  } finally {
    Hints.removeSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER);
  }
}

代码示例来源:origin: geotools/geotools

/** Tests fetching the URN authority when the "longitude first axis order" hint is set. */
  @Test
  public void testWhenForceXY() throws FactoryException {
    try {
      Hints.putSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING, "http");
      Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
      try {
        ReferencingFactoryFinder.getCRSAuthorityFactory("URN:OGC:DEF", null);
        fail("URN factory should not accept FORCE_LONGITUDE_FIRST_AXIS_ORDER = TRUE");
      } catch (FactoryNotFoundException e) {
        // This is the expected exception.
      }
      CoordinateReferenceSystem crs = CRS.decode("URN:OGC:DEF:CRS:CRS:84", true);
      assertTrue(CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, crs));
      crs = CRS.decode("URN:OGC:DEF:CRS:CRS:84");
      assertTrue(CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, crs));
    } finally {
      Hints.removeSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING);
      Hints.removeSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER);
    }
  }
}

代码示例来源:origin: geotools/geotools

/**
 * Tests fetching the HTTP URI CRS factory when the "longitude first axis order" hint is set.
 * This test ensures that the factory ignores this hint.
 */
@Test
public void testWhenForceXY() throws FactoryException {
  try {
    Hints.putSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING, "http");
    Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
    try {
      ReferencingFactoryFinder.getCRSAuthorityFactory("http://www.opengis.net/def", null);
      fail("HTTP URI factory should not accept FORCE_LONGITUDE_FIRST_AXIS_ORDER = true");
    } catch (FactoryNotFoundException e) {
      // success
    }
    CoordinateReferenceSystem crs =
        CRS.decode("http://www.opengis.net/def/crs/CRS/0/84", true);
    assertTrue(CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, crs));
    crs = CRS.decode("http://www.opengis.net/def/crs/CRS/0/84");
    assertTrue(CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, crs));
  } finally {
    Hints.removeSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING);
    Hints.removeSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER);
  }
}

代码示例来源:origin: geotools/geotools

CRS.getAxisOrder(CRS.decode("urn:x-ogc:def:crs:EPSG::4326", true)));
} finally {
  Hints.removeSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER);

代码示例来源:origin: geotools/geotools

/** Tests the (longitude, latitude) axis order for EPSG:4326. */
public void testForcedAxisOrder() throws NoSuchAuthorityCodeException, FactoryException {
  final CoordinateReferenceSystem crs = CRS.decode("EPSG:4326", true);
  final CoordinateSystem cs = crs.getCoordinateSystem();
  assertEquals(2, cs.getDimension());
  CoordinateSystemAxis axis0 = cs.getAxis(0);
  assertEquals("Long", axis0.getAbbreviation());
  CoordinateSystemAxis axis1 = cs.getAxis(1);
  assertEquals("Lat", axis1.getAbbreviation());
  final CoordinateReferenceSystem standard = CRS.decode("EPSG:4326");
  assertFalse(
      "Should not be (long,lat) axis order.", CRS.equalsIgnoreMetadata(crs, standard));
  final CoordinateReferenceSystem def;
  try {
    assertNull(
        Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE));
    def = CRS.decode("EPSG:4326");
  } finally {
    assertEquals(
        Boolean.TRUE,
        Hints.removeSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER));
  }
  assertEquals("Expected (long,lat) axis order.", crs, def);
  assertSame("Should be back to (lat,long) axis order.", standard, CRS.decode("EPSG:4326"));
}

代码示例来源:origin: geotools/geotools

/** Tests the {@link HTTP_AuthorityFactory#defaultAxisOrderHints} method. */
@Test
public void testAxisOrderHints() {
  // The following are required for proper execution of the remaining of this test.
  assertNull(Hints.getSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER));
  assertNull(Hints.getSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING));
  // Standard behavior should be to set FORCE_LONGITUDE_FIRST_AXIS_ORDER to false.
  assertFalse(HTTP_AuthorityFactory.defaultAxisOrderHints(null, "http"));
  try {
    // The hints should be ignored.
    Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
    assertFalse(HTTP_AuthorityFactory.defaultAxisOrderHints(null, "http"));
    // The hints should be honored.
    Hints.putSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING, "http");
    assertTrue(HTTP_AuthorityFactory.defaultAxisOrderHints(null, "http"));
    // The hints should be ignored.
    Hints.putSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING, "urn");
    assertFalse(HTTP_AuthorityFactory.defaultAxisOrderHints(null, "http"));
    // The hints should be honored.
    Hints.putSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING, "http, urn");
    assertTrue(HTTP_AuthorityFactory.defaultAxisOrderHints(null, "http"));
    // The hints should be honored.
    Hints.putSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING, "urn, http");
    assertTrue(HTTP_AuthorityFactory.defaultAxisOrderHints(null, "http"));
  } finally {
    Hints.removeSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER);
    Hints.removeSystemDefault(Hints.FORCE_AXIS_ORDER_HONORING);
  }
}

相关文章