コード例 #1
0
  private void saveNetworkElementChangement() {
    simulationBox.endEdition();
    if (simulationBox.isElementModified()) {
      if (simulationBox.isAnimationModified()) {

      } else {
        SimulationElement modifiedElement = simulationBox.getModifiedElement();
        if (isTransit(modifiedElement)) {
          Transit modifiedTransit = (Transit) modifiedElement;
          currentTransit.modifyTransit(modifiedTransit.getIdentifier(), modifiedTransit);
        } else {
          currentNetwork.modifyNetworkElement(modifiedElement.getIdentifier(), modifiedElement);
          if (simulationBox.isThereASecondSegment()) {
            Segment secondSegment = simulationBox.getModifiedSecondWay();
            currentNetwork.modifyNetworkElement(secondSegment.getIdentifier(), secondSegment);
          }
        }
        updateNetworkData();
        simulationBox.refreshElementsAfterModification();
      }
    }
  }
コード例 #2
0
 private boolean isTransit(SimulationElement modifiedElement) {
   return modifiedElement.getClass().getSimpleName().equals(TransportNeed.class.getSimpleName())
       || modifiedElement.getClass().getSimpleName().equals(Circuit.class.getSimpleName());
 }