/**
   * Sets the way participating in the turn restriction in a given role.
   *
   * @param role the role. Must not be null.
   * @param wayId the id of the way to set
   * @exception IllegalArgumentException thrown if role is null
   * @exception IllegalArgumentException thrown if wayId != null isn't the id of a way
   * @exception IllegalStateException thrown the no way with this id was found in the dataset
   */
  public void setTurnRestrictionLeg(TurnRestrictionLegRole role, PrimitiveId wayId) {
    CheckParameterUtil.ensureParameterNotNull(role, "role");
    if (wayId == null) {
      setTurnRestrictionLeg(role, (Way) null);
      return;
    }
    if (!wayId.getType().equals(OsmPrimitiveType.WAY)) {
      throw new IllegalArgumentException(
          MessageFormat.format(
              "parameter ''wayId'' of type {0} expected, got {1}",
              OsmPrimitiveType.WAY, wayId.getType()));
    }

    OsmPrimitive p = layer.data.getPrimitiveById(wayId);
    if (p == null) {
      throw new IllegalStateException(
          MessageFormat.format(
              "didn''t find way with id {0} in layer ''{1}''", wayId, layer.getName()));
    }
    setTurnRestrictionLeg(role, (Way) p);
  }
Example #2
0
 /**
  * Replies true if the primitive with id <code>id</code> is participating in this conflict
  *
  * @param id the primitive id
  * @return true if the primitive <code>primitive</code> is participating in this conflict
  */
 public boolean isParticipating(PrimitiveId id) {
   if (id == null) return false;
   return id.equals(my.getPrimitiveId()) || id.equals(their.getPrimitiveId());
 }