예제 #1
0
  @org.junit.Test
  public void testRegionMap() {
    RegionMap rm =
        (RegionMap)
            CopyAndSerializationUtils.restore(
                new File(Config.getInstance().base_folder + "/RegionMap/FIX_Piemonte.ser"));
    RegionI r = null;

    r = rm.get(7.687631, 45.070445);
    System.out.println(r.getName());
    assertEquals("Test Region Map FIX_Piemonte with a point in Torino", "TORINO", r.getName());

    r = rm.get(7.950863499245511, 45.31123601252711);
    System.out.println(r.getName());
    assertEquals("Test Region Map FIX_Piemonte with a point in Torino", "VILLAREGGIA", r.getName());

    r = rm.get(7.276073651663653, 44.88341453339817);
    System.out.println(r.getName());
    assertEquals(
        "Test Region Map FIX_Piemonte with a point in Torino",
        "SAN SECONDO DI PINEROLO",
        r.getName());

    r = rm.get(8.495767352632413, 44.80357151257454);
    System.out.println(r.getName());
    assertEquals(
        "Test Region Map FIX_Piemonte with a point in Torino",
        "BORGORATTO ALESSANDRINO",
        r.getName());
  }
예제 #2
0
  public static String drawHeatMap(String name, Map<String, Double> map, double max) {
    RegionMap nm =
        DataFactory.getNetworkMapFactory().getNetworkMap(Config.getInstance().pls_start_time);
    StringBuffer result = new StringBuffer();
    for (String celllac : map.keySet()) {
      RegionI nc = nm.getRegion(celllac);
      int index = (int) (map.get(celllac) / max * (Colors.HEAT_COLORS.length - 1));

      result.append(nc.toKml(Colors.rgb2kmlstring(Colors.HEAT_COLORS[index]), ""));
    }
    return result.toString();
  }
예제 #3
0
  @Override
  public void start(Stage primaryStage) {
    Config.readConfigs();
    try {
      client = new ClientImpl();
    } catch (RemoteException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }

    addLogin(primaryStage);
  }
예제 #4
0
  private String getPatch(long revA, long revB) throws SVNException, UnsupportedEncodingException {
    // Prepare required arguments.
    SVNURL svnURL = SVNURL.fromFile(getDirectory());

    // Get diffClient.
    SVNClientManager clientManager = SVNClientManager.newInstance();
    SVNDiffClient diffClient = clientManager.getDiffClient();

    // Using diffClient, write the changes by commitId into
    // byteArrayOutputStream, as unified format.
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    diffClient.doDiff(
        svnURL,
        null,
        SVNRevision.create(revA),
        SVNRevision.create(revB),
        SVNDepth.INFINITY,
        true,
        byteArrayOutputStream);

    return byteArrayOutputStream.toString(Config.getCharset().name());
  }
예제 #5
0
 public static File getRootDirectory() {
   return new File(Config.getYobiHome(), getRepoPrefix());
 }
예제 #6
0
 public void setUp() {
   Config.setPathFile("config/test/db_config_test.xml");
 }