コード例 #1
0
ファイル: WayData.java プロジェクト: Nyanna/XY.Gomps
 /**
  * default constructor
  *
  * @param path
  */
 public WayData(final int id, final Double[][] path, final Integer[] tags) {
   this.id = id;
   this.tags = tags;
   this.path = path;
   final Boundary maxmin = new Boundary(new char[] {'<', '<', '>', '>'});
   for (int i = 0; i < path.length; i++) {
     final Double[] pair = path[i];
     maxmin.check(
         new double[] {
           pair[0].doubleValue(),
           pair[1].doubleValue(),
           pair[0].doubleValue(),
           pair[1].doubleValue()
         });
   }
   final double minLat = maxmin.values[0];
   final double minLon = maxmin.values[1];
   final double maxLat = maxmin.values[2];
   final double maxLon = maxmin.values[3];
   final double midLat = minLat + (maxLat - minLat) / 2;
   final double midLon = minLon + (maxLon - minLon) / 2;
   center = new Point(midLat, midLon);
   bounds =
       new Rectangle(new Point(minLat, minLon), new Dimension(maxLat - minLat, maxLon - minLon));
   if (path.length > 2 && Arrays.equals(path[0], path[path.length - 1])) {
     type = IDataObject.DATA_AREA;
   }
 }