/*! \internal */ void QDeclarativePolygonMapItem::updateMapItem() { if (!map() || path_.count() == 0) return; geometry_.updateSourcePoints(*map(), path_); geometry_.updateScreenPoints(*map()); if (border_.color() != Qt::transparent && border_.width() > 0) { QList<QGeoCoordinate> closedPath = path_; closedPath << closedPath.first(); borderGeometry_.updateSourcePoints(*map(), closedPath); borderGeometry_.updateScreenPoints(*map(), border_.width()); QList<QGeoMapItemGeometry *> geoms; geoms << &geometry_ << &borderGeometry_; QRectF combined = QGeoMapItemGeometry::translateToCommonOrigin(geoms); setWidth(combined.width()); setHeight(combined.height()); } else { borderGeometry_.clear(); setWidth(geometry_.sourceBoundingBox().width()); setHeight(geometry_.sourceBoundingBox().height()); } setPositionOnMap(path_.at(0), -1 * geometry_.sourceBoundingBox().topLeft()); update(); }
/*! \internal */ void QDeclarativeRectangleMapItem::updateMapItem() { if (!map() || !topLeft().isValid() || !bottomRight().isValid()) return; geometry_.updatePoints(*map(), topLeft_, bottomRight_); QList<QGeoCoordinate> pathClosed; pathClosed << topLeft_; pathClosed << QGeoCoordinate(topLeft_.latitude(), bottomRight_.longitude()); pathClosed << bottomRight_; pathClosed << QGeoCoordinate(bottomRight_.latitude(), topLeft_.longitude()); pathClosed << pathClosed.first(); if (border_.color() != Qt::transparent && border_.width() > 0) { borderGeometry_.updateSourcePoints(*map(), pathClosed); borderGeometry_.updateScreenPoints(*map(), border_.width()); QList<QGeoMapItemGeometry *> geoms; geoms << &geometry_ << &borderGeometry_; QRectF combined = QGeoMapItemGeometry::translateToCommonOrigin(geoms); setWidth(combined.width()); setHeight(combined.height()); } else { borderGeometry_.clear(); setWidth(geometry_.screenBoundingBox().width()); setHeight(geometry_.screenBoundingBox().height()); } setPositionOnMap(pathClosed.at(0), geometry_.firstPointOffset()); update(); }
/*! \internal */ void QDeclarativePolylineMapItem::updateMapItem() { if (!map() || path_.count() == 0) return; geometry_.updateSourcePoints(*map(), path_); geometry_.updateScreenPoints(*map(), line_.width()); setWidth(geometry_.sourceBoundingBox().width()); setHeight(geometry_.sourceBoundingBox().height()); setPositionOnMap(path_.at(0), -1 * geometry_.sourceBoundingBox().topLeft()); update(); }
/*! \internal */ void QDeclarativeCircleMapItem::updateMapItem() { if (!map() || !center().isValid()) return; QScopedValueRollback<bool> rollback(updatingGeometry_); updatingGeometry_ = true; if (geometry_.isSourceDirty()) { circlePath_.clear(); calculatePeripheralPoints(circlePath_, center_, radius_, 125); } QGeoCoordinate leftBoundCoord; int pathCount = circlePath_.size(); bool preserve = preserveCircleGeometry(circlePath_, center_, radius_, leftBoundCoord); geometry_.setPreserveGeometry(preserve, leftBoundCoord); geometry_.updateSourcePoints(*map(), circlePath_); if (crossEarthPole(center_, radius_) && circlePath_.size() == pathCount) geometry_.updateScreenPointsInvert(*map()); // invert fill area for really huge circles else geometry_.updateScreenPoints(*map()); if (border_.color() != Qt::transparent && border_.width() > 0) { QList<QGeoCoordinate> closedPath = circlePath_; closedPath << closedPath.first(); borderGeometry_.setPreserveGeometry(preserve, leftBoundCoord); borderGeometry_.updateSourcePoints(*map(), closedPath); borderGeometry_.updateScreenPoints(*map(), border_.width()); QList<QGeoMapItemGeometry *> geoms; geoms << &geometry_ << &borderGeometry_; QRectF combined = QGeoMapItemGeometry::translateToCommonOrigin(geoms); setWidth(combined.width()); setHeight(combined.height()); } else { borderGeometry_.clear(); setWidth(geometry_.screenBoundingBox().width()); setHeight(geometry_.screenBoundingBox().height()); } setPositionOnMap(circlePath_.at(0), geometry_.firstPointOffset()); update(); }