src/xodr/validation/lane_link_validation.cpp
static bool validateLaneLinkInRange(LaneSectionContactPointKey aSectionContactPointKey,
                                    LaneSectionContactPointKey bSectionContactPointKey, LaneID fromLaneId,
                                    LaneID toLaneId, bool roadsOpposingDirections, LaneID toLaneIDsMin,
                                    LaneID toLaneIDsMax, std::vector<std::unique_ptr<LinkValidationError>>& errors)
{
    if (toLaneId == LaneID(0))
    {
        LaneLinkToCenterLaneError* error = new LaneLinkToCenterLaneError();
        error->aSectionContactPointKey_ = aSectionContactPointKey;
        error->bSectionContactPointKey_ = bSectionContactPointKey;
        error->fromLaneId_ = fromLaneId;
        errors.emplace_back(error);
        return false;
    }

    // If the two roads have the same direction (ie, one is the
    // successor of the other, and the other the predecessor of the
    // first one), then the two lanes must be on the same side of their
    // respective reference line.
    //
    // If the two roads have opposing directions (ie, they meet head to
    // head or tail to tail), then the two lanes must be on opposite
    // sides of their respective reference lines.
    if (fromLaneId.sameSide(toLaneId) == roadsOpposingDirections)
    {
        LaneLinkOpposingDirections* error = new LaneLinkOpposingDirections();
        error->aSectionContactPointKey_ = aSectionContactPointKey;
        error->bSectionContactPointKey_ = bSectionContactPointKey;
        error->aLaneId_ = fromLaneId;
        error->bLaneId_ = toLaneId;
        errors.emplace_back(error);
        return false;
    }

    if (toLaneId < toLaneIDsMin || toLaneId > toLaneIDsMax)
    {
        LaneLinkTargetOutOfRange* error = new LaneLinkTargetOutOfRange();
        error->aSectionContactPointKey_ = aSectionContactPointKey;
        error->bSectionContactPointKey_ = bSectionContactPointKey;
        error->aLaneId_ = fromLaneId;
        error->bLaneId_ = toLaneId;
        errors.emplace_back(error);
        return false;
    }

    return true;
}
/**
 * @brief Validates whether 'toLaneId' is in the required range.
 *
 * The valid range for 'toLaneId' is the range of all lanes in the destination
 * lane section which are of the direction matching the direction of the
 * 'from' lane.
 *
 * This test is common to many of the more specific cases, so that's why it's
 * separated into a function of its own.
 *
 * @param fromLaneId            The lane id the lane link originates from. This
 *                              lane id is assumed to be valid, and assumed to
 *                              not refer to the center lane.
 * @param toLaneId              The lane id of the target of the lane link.
 * @param roadsOpposingDirections   Whether the road containing the from lane
 *                              and the road containing the to lane have
 *                              opposing directions.
 * @param toLaneIDsMin          The (inclusive) lower bound of the range of
 *                              valid 'to' lane id's.
 * @param toLaneIDsMax          The (exclusive) upper bound of the range of
 *                              valid 'to' lane id's.
 */
@brief Validates whether 'toLaneId' is in the required range.
The valid range for 'toLaneId' is the range of all lanes in the destination
lane section which are of the direction matching the direction of the
'from' lane.

This test is common to many of the more specific cases, so that's why it's
separated into a function of its own.

@param fromLaneId            The lane id the lane link originates from. This
lane id is assumed to be valid, and assumed to
not refer to the center lane.
@param toLaneId              The lane id of the target of the lane link.
@param roadsOpposingDirections   Whether the road containing the from lane
and the road containing the to lane have
opposing directions.
@param toLaneIDsMin          The (inclusive) lower bound of the range of
valid 'to' lane id's.
@param toLaneIDsMax          The (exclusive) upper bound of the range of
valid 'to' lane id's.
@brief Validates whether ' toLaneId ' is in the required range . The valid range for ' toLaneId ' is the range of all lanes in the destination lane section which are of the direction matching the direction of the ' from ' lane . This test is common to many of the more specific cases so that ' s why it ' s separated into a function of its own . @param fromLaneId The lane id the lane link originates from . This lane id is assumed to be valid and assumed to not refer to the center lane . @param toLaneId The lane id of the target of the lane link . @param roadsOpposingDirections Whether the road containing the from lane and the road containing the to lane have opposing directions . @param toLaneIDsMin The ( inclusive ) lower bound of the range of valid ' to ' lane id ' s . @param toLaneIDsMax The ( exclusive ) upper bound of the range of valid ' to ' lane id ' s .
static bool validateLaneLinkInRange(LaneSectionContactPointKey aSectionContactPointKey,
                                    LaneSectionContactPointKey bSectionContactPointKey, LaneID fromLaneId,
                                    LaneID toLaneId, bool roadsOpposingDirections, LaneID toLaneIDsMin,
                                    LaneID toLaneIDsMax, std::vector<std::unique_ptr<LinkValidationError>>& errors)
{
    if (toLaneId == LaneID(0))
    {
        LaneLinkToCenterLaneError* error = new LaneLinkToCenterLaneError();
        error->aSectionContactPointKey_ = aSectionContactPointKey;
        error->bSectionContactPointKey_ = bSectionContactPointKey;
        error->fromLaneId_ = fromLaneId;
        errors.emplace_back(error);
        return false;
    }
     If the two roads have opposing directions (ie, they meet head to
     head or tail to tail), then the two lanes must be on opposite
     sides of their respective reference lines.
    if (fromLaneId.sameSide(toLaneId) == roadsOpposingDirections)
    {
        LaneLinkOpposingDirections* error = new LaneLinkOpposingDirections();
        error->aSectionContactPointKey_ = aSectionContactPointKey;
        error->bSectionContactPointKey_ = bSectionContactPointKey;
        error->aLaneId_ = fromLaneId;
        error->bLaneId_ = toLaneId;
        errors.emplace_back(error);
        return false;
    }
    if (toLaneId < toLaneIDsMin || toLaneId > toLaneIDsMax)
    {
        LaneLinkTargetOutOfRange* error = new LaneLinkTargetOutOfRange();
        error->aSectionContactPointKey_ = aSectionContactPointKey;
        error->bSectionContactPointKey_ = bSectionContactPointKey;
        error->aLaneId_ = fromLaneId;
        error->bLaneId_ = toLaneId;
        errors.emplace_back(error);
        return false;
    }
    return true;
}
static bool validateLaneLinkInRange ( LaneSectionContactPointKey aSectionContactPointKey , LaneSectionContactPointKey bSectionContactPointKey , LaneID fromLaneId , LaneID toLaneId , bool roadsOpposingDirections , LaneID toLaneIDsMin , LaneID toLaneIDsMax , std :: vector < std :: unique_ptr < LinkValidationError > > & errors ) { if ( toLaneId == LaneID ( 0 ) ) { LaneLinkToCenterLaneError * error = new LaneLinkToCenterLaneError ( ) ; error -> aSectionContactPointKey_ = aSectionContactPointKey ; error -> bSectionContactPointKey_ = bSectionContactPointKey ; error -> fromLaneId_ = fromLaneId ; errors . emplace_back ( error ) ; return false ; } if ( fromLaneId . sameSide ( toLaneId ) == roadsOpposingDirections ) { LaneLinkOpposingDirections * error = new LaneLinkOpposingDirections ( ) ; error -> aSectionContactPointKey_ = aSectionContactPointKey ; error -> bSectionContactPointKey_ = bSectionContactPointKey ; error -> aLaneId_ = fromLaneId ; error -> bLaneId_ = toLaneId ; errors . emplace_back ( error ) ; return false ; } if ( toLaneId < toLaneIDsMin || toLaneId > toLaneIDsMax ) { LaneLinkTargetOutOfRange * error = new LaneLinkTargetOutOfRange ( ) ; error -> aSectionContactPointKey_ = aSectionContactPointKey ; error -> bSectionContactPointKey_ = bSectionContactPointKey ; error -> aLaneId_ = fromLaneId ; error -> bLaneId_ = toLaneId ; errors . emplace_back ( error ) ; return false ; } return true ; }
@brief Validates whether 'toLaneId' is in the required range.
@brief Validates whether ' toLaneId ' is in the required range .
// If the two roads have the same direction (ie, one is the // successor of the other, and the other the predecessor of the // first one), then the two lanes must be on the same side of their // respective reference line. // // If the two roads have opposing directions (ie, they meet head to // head or tail to tail), then the two lanes must be on opposite // sides of their respective reference lines.