/*! \internal */ void QDeclarativeRectangleMapItem::dragEnded() { QPointF newTopLeftPoint = QPointF(x(),y()); QGeoCoordinate newTopLeft = map()->screenPositionToCoordinate(newTopLeftPoint, false); if (newTopLeft.isValid()) { // calculate new geo width while checking for dateline crossing const double lonW = bottomRight_.longitude() > topLeft_.longitude() ? bottomRight_.longitude() - topLeft_.longitude() : bottomRight_.longitude() + 360 - topLeft_.longitude(); const double latH = qAbs(bottomRight_.latitude() - topLeft_.latitude()); QGeoCoordinate newBottomRight; // prevent dragging over valid min and max latitudes if (QLocationUtils::isValidLat(newTopLeft.latitude() - latH)) { newBottomRight.setLatitude(newTopLeft.latitude() - latH); } else { newBottomRight.setLatitude(QLocationUtils::clipLat(newTopLeft.latitude() - latH)); newTopLeft.setLatitude(newBottomRight.latitude() + latH); } // handle dateline crossing newBottomRight.setLongitude(QLocationUtils::wrapLong(newTopLeft.longitude() + lonW)); newBottomRight.setAltitude(newTopLeft.altitude()); topLeft_ = newTopLeft; bottomRight_ = newBottomRight; geometry_.setPreserveGeometry(true, newTopLeft); borderGeometry_.setPreserveGeometry(true, newTopLeft); geometry_.markSourceDirty(); borderGeometry_.markSourceDirty(); updateMapItem(); emit topLeftChanged(topLeft_); emit bottomRightChanged(bottomRight_); } }
void QDeclarativeGeoBoundingBox::setBottomRight(QDeclarativeCoordinate *coordinate) { if (m_box.bottomRight() == coordinate->coordinate()) return; m_box.setBottomRight(coordinate->coordinate()); synchronizeDeclarative(); emit bottomRightChanged(); }
/*! \qmlproperty coordinate MapRectangle::bottomRight This property holds the bottom-right coordinate of the MapRectangle which can be used to retrieve its longitude, latitude and altitude. */ void QDeclarativeRectangleMapItem::setBottomRight(const QGeoCoordinate &bottomRight) { if (bottomRight_ == bottomRight) return; bottomRight_ = bottomRight; markSourceDirtyAndUpdate(); emit bottomRightChanged(bottomRight_); }
void QDeclarativeLandmarkBoxFilter::setBottomRight(QDeclarativeCoordinate* coordinate) { if (m_bottomRight == coordinate) return; m_bottomRight = coordinate; if (m_topLeft && m_bottomRight) m_filter.setBoundingBox(QGeoBoundingBox(m_topLeft->coordinate(), m_bottomRight->coordinate())); emit bottomRightChanged(); emit filterContentChanged(); }
/*! \qmlproperty coordinate MapRectangle::bottomRight This property holds the bottom-right coordinate of the MapRectangle which can be used to retrieve its longitude, latitude and altitude. */ void QDeclarativeRectangleMapItem::setBottomRight(const QGeoCoordinate &bottomRight) { if (bottomRight_ == bottomRight) return; bottomRight_ = bottomRight; geometry_.markSourceDirty(); borderGeometry_.markSourceDirty(); updateMapItem(); emit bottomRightChanged(bottomRight_); }
/*! \internal */ void QDeclarativeRectangleMapItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { if (updatingGeometry_ || newGeometry.topLeft() == oldGeometry.topLeft()) { QDeclarativeGeoMapItemBase::geometryChanged(newGeometry, oldGeometry); return; } QDoubleVector2D newTopLeftPoint = QDoubleVector2D(x(),y()); QGeoCoordinate newTopLeft = map()->itemPositionToCoordinate(newTopLeftPoint, false); if (newTopLeft.isValid()) { // calculate new geo width while checking for dateline crossing const double lonW = bottomRight_.longitude() > topLeft_.longitude() ? bottomRight_.longitude() - topLeft_.longitude() : bottomRight_.longitude() + 360 - topLeft_.longitude(); const double latH = qAbs(bottomRight_.latitude() - topLeft_.latitude()); QGeoCoordinate newBottomRight; // prevent dragging over valid min and max latitudes if (QLocationUtils::isValidLat(newTopLeft.latitude() - latH)) { newBottomRight.setLatitude(newTopLeft.latitude() - latH); } else { newBottomRight.setLatitude(QLocationUtils::clipLat(newTopLeft.latitude() - latH)); newTopLeft.setLatitude(newBottomRight.latitude() + latH); } // handle dateline crossing newBottomRight.setLongitude(QLocationUtils::wrapLong(newTopLeft.longitude() + lonW)); newBottomRight.setAltitude(newTopLeft.altitude()); topLeft_ = newTopLeft; bottomRight_ = newBottomRight; geometry_.setPreserveGeometry(true, newTopLeft); borderGeometry_.setPreserveGeometry(true, newTopLeft); markSourceDirtyAndUpdate(); emit topLeftChanged(topLeft_); emit bottomRightChanged(bottomRight_); } // Not calling QDeclarativeGeoMapItemBase::geometryChanged() as it will be called from a nested // call to this function. }