示例#1
0
  public void cutBoundaryFenceModel(BoundaryFenceModel boundaryFenceModel, int vertex) {
    BoundaryFenceModel model2 = (BoundaryFenceModel) boundaryFenceModel.clone();
    for (int i = 0; i <= vertex; i++)
      model2.removeVertexModel((VertexModel) model2.getVertexAL().get(0));

    for (int i = boundaryFenceModel.getVertexAL().size() - 1; i > vertex; i--)
      boundaryFenceModel.removeVertexModel(
          (VertexModel) boundaryFenceModel.getVertexAL().get(vertex + 1));

    addBoundaryFenceModel(model2);
  }
示例#2
0
  public void mergeBoundaryFences(
      BoundaryFenceModel model1,
      BoundaryFenceModel model2,
      VertexModel vertexModel1,
      VertexModel vertexModel2) {
    boolean insert = model1.getVertexAL().get(0) == vertexModel1;
    ArrayList arrayList = model2.getVertexAL();
    if (vertexModel2 == arrayList.get(0)) {
      for (int i = 1; i < arrayList.size(); i++)
        if (insert)
          model1.insertVertexModel((VertexModel) ((VertexModel) arrayList.get(i)).clone(), 0);
        else model1.addVertexModel((VertexModel) ((VertexModel) arrayList.get(i)).clone());

    } else {
      for (int i = arrayList.size() - 2; i >= 0; i--)
        if (insert)
          model1.insertVertexModel((VertexModel) ((VertexModel) arrayList.get(i)).clone(), 0);
        else model1.addVertexModel((VertexModel) ((VertexModel) arrayList.get(i)).clone());
    }
    removeBoundaryFenceModel(model2);
  }