Exemple #1
0
  /**
   * 根据新产生的Block边界Node分割道路,维护原来路网关系 新产生道路splitRoad
   *
   * @param road 原道路
   * @param index Node产生所在原道路中的位置
   * @param splitPoint Node具体位置坐标点
   */
  private RoadNew createSplitRoad(
      RoadNew road,
      int Indexfrom,
      int indexTo,
      List<ShpPoint> points,
      ShpPoint headerSplitPoint,
      ShpPoint splitPoint,
      ShpPoint nodePoint) {
    // 新建Block边界Node
    NodeNew blockNode = new NodeNew();
    blockNode.point = nodePoint; // 原始坐标

    // 创建新的道路形状点
    List<ShpPoint> splitPoints =
        new ArrayList<ShpPoint>(
            points.subList(Indexfrom, indexTo)); // 避免ConcurrentModificationException
    if (headerSplitPoint != null) {
      splitPoints.add(0, ShpPoint.valueOf(headerSplitPoint));
    }

    splitPoints.add(ShpPoint.valueOf(splitPoint));
    RoadNew splitRoad = new RoadNew();

    splitRoad.copy(road);
    splitRoad.coordinate = splitPoints;

    // 第一个开始点有价值
    splitRoad.startAngle30m = road.startAngle30m;
    splitRoad.startAngle60m = road.startAngle60m;
    // 在合并Rout时需要判断角度
    splitRoad.endAngle30m = -90;
    splitRoad.endAngle60m = -90;
    road.startAngle30m = 90;
    road.startAngle60m = 90;
    // 建立,维护拓扑关系
    splitRoad.startNode = road.startNode;
    road.startNode.roads.add(splitRoad);
    road.startNode.roads.remove(road);

    blockNode.roads.add(splitRoad);
    blockNode.roads.add(road);
    // road.startNode = splitRoad.endNode = blockNode;
    road.startNode = blockNode;
    splitRoad.endNode = blockNode;

    if (road.fow == defineFOW.JunctionLink) {
      road.endNode.intersection.allNodes.add(blockNode);
      blockNode.intersection = road.endNode.intersection;
    }

    this.nodeList.add(blockNode);
    return splitRoad;
  }
Exemple #2
0
  // 该方法是为了保证单个道路的形状点个数少于256 ,从而在格式输出的时候没有问题
  void splitRoadByPointCount() {
    for (int i = this.roadList.size() - 1; i >= 0; i--) {
      RoadNew road = this.roadList.get(i);
      for (int count = 0; count < 100; count++) {
        if (road.coordinate.size() > 255) {
          NodeNew node = new NodeNew();
          node.point = ShpPoint.valueOf(road.coordinate.get(254));
          RoadNew splitRoad = new RoadNew();
          splitRoad.copy(road); // 长度不需要计算 在分割完成后统一重新计算
          splitRoad.coordinate.addAll(road.coordinate.subList(0, 254));
          splitRoad.coordinate.add(ShpPoint.valueOf(road.coordinate.get(254)));
          road.coordinate =
              new ArrayList<ShpPoint>(road.coordinate.subList(255, road.coordinate.size()));
          // 第一个开始点有价值
          splitRoad.startAngle30m = road.startAngle30m;
          splitRoad.startAngle60m = road.startAngle60m;
          // 在合并Rout时需要判断角度
          splitRoad.endAngle30m = -90;
          splitRoad.endAngle60m = -90;
          road.startAngle30m = 90;
          road.startAngle60m = 90;
          // 维护拓扑关系
          splitRoad.startNode = road.startNode;
          splitRoad.endNode = node;
          road.startNode = node;

          splitRoad.startNode.roads.remove(road);
          splitRoad.startNode.roads.add(splitRoad);

          node.roads.add(splitRoad);
          node.roads.add(road);

          this.nodeList.add(node);
          this.roadList.add(splitRoad);
        } else if (road.coordinate.size() < 2
            || (road.coordinate.size() == 2
                && road.coordinate.get(0).equals(road.coordinate.get(1)))) {
          road.delFlag = true;
        } else {
          break;
        }
      }
    }
  }