Exemplo n.º 1
0
    int compareWith(const GeographyPointValue& rhs) const {

        // Caller guarantees that neither side is null
        assert(! isNull());
        assert(! rhs.isNull());

        Coord lhsLong = getLongitude();
        Coord rhsLong = rhs.getLongitude();
        if (lhsLong < rhsLong) {
            return VALUE_COMPARE_LESSTHAN;
        }

        if (lhsLong > rhsLong) {
            return VALUE_COMPARE_GREATERTHAN;
        }

        // latitude is equal; compare longitude
        Coord lhsLat = getLatitude();
        Coord rhsLat = rhs.getLatitude();
        if (lhsLat < rhsLat) {
            return VALUE_COMPARE_LESSTHAN;
        }

        if (lhsLat > rhsLat) {
            return VALUE_COMPARE_GREATERTHAN;
        }

        return VALUE_COMPARE_EQUAL;
    }
Exemplo n.º 2
0
template<> NValue NValue::callUnary<FUNC_VOLT_POINT_LATITUDE>() const {
    if (isNull()) {
        return NValue::getNullValue(VALUE_TYPE_DOUBLE);
    }
    const GeographyPointValue point = getGeographyPointValue();
    NValue retVal(VALUE_TYPE_DOUBLE);
    retVal.getDouble() = point.getLatitude();
    return retVal;
}