当前位置: 首页>>代码示例>>C++>>正文


C++ DMetadata::getGPSLatitudeNumber方法代码示例

本文整理汇总了C++中DMetadata::getGPSLatitudeNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ DMetadata::getGPSLatitudeNumber方法的具体用法?C++ DMetadata::getGPSLatitudeNumber怎么用?C++ DMetadata::getGPSLatitudeNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DMetadata的用法示例。


在下文中一共展示了DMetadata::getGPSLatitudeNumber方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setMetadata

void ImagePropertiesGPSTab::setMetadata(const DMetadata& meta, const KUrl& url)
{
    double lat, lng;
    const bool haveCoordinates = meta.getGPSLatitudeNumber(&lat) && meta.getGPSLongitudeNumber(&lng);

    if (haveCoordinates)
    {
        double alt;
        const bool haveAlt = meta.getGPSAltitude(&alt);

        KGeoMap::GeoCoordinates coordinates(lat, lng);

        if (haveAlt)
        {
            coordinates.setAlt(alt);
        }

        GPSImageInfo gpsInfo;
        gpsInfo.coordinates = coordinates;
        gpsInfo.dateTime    = meta.getImageDateTime();
        gpsInfo.rating      = meta.getImageRating();
        gpsInfo.url         = url;
        setGPSInfoList(GPSImageInfo::List() << gpsInfo);
    }
    else
    {
        clearGPSInfo();
    }
}
开发者ID:rickysarraf,项目名称:digikam,代码行数:29,代码来源:imagepropertiesgpstab.cpp

示例2: itemCoordinates

/**
 * @brief Gets the coordinates of a marker found at current model index.
 * @param index Current model index.
 * @param coordinates Here will be returned the coordinates of the current marker.
 * @return True, if the marker has coordinates.
 */
bool MapViewModelHelper::itemCoordinates(const QModelIndex& index, GeoIface::GeoCoordinates* const coordinates) const
{
    switch (d->application)
    {
        case MapWidgetView::ApplicationDigikam:
        {
            const ImageInfo info = d->model->imageInfo(index);

            if (info.isNull() || !info.hasCoordinates())
            {
                return false;
            }

            *coordinates = GeoIface::GeoCoordinates(info.latitudeNumber(), info.longitudeNumber());
            break;
        }

        case MapWidgetView::ApplicationImportUI:
        {
            const CamItemInfo info = d->importModel->camItemInfo(index);

            if (info.isNull())
            {
                return false;
            }

            const DMetadata meta(info.url().toLocalFile());
            double          lat, lng;
            const bool      haveCoordinates = meta.getGPSLatitudeNumber(&lat) && meta.getGPSLongitudeNumber(&lng);

            if (!haveCoordinates)
            {
                return false;
            }

            GeoIface::GeoCoordinates tmpCoordinates(lat, lng);

            double     alt;
            const bool haveAlt = meta.getGPSAltitude(&alt);

            if (haveAlt)
            {
                tmpCoordinates.setAlt(alt);
            }

            *coordinates = tmpCoordinates;
            break;
        }
    }

    return true;
}
开发者ID:KDE,项目名称:digikam,代码行数:58,代码来源:mapwidgetview.cpp

示例3: bestRepresentativeIndexFromList

/**
 * @brief This function finds the best representative marker from a group of markers. This is needed to display a thumbnail for a marker group.
 * @param indices A list containing markers.
 * @param sortKey Determines the sorting options and is actually of type GPSImageInfoSorter::SortOptions
 * @return Returns the index of the marker.
 */
QPersistentModelIndex MapViewModelHelper::bestRepresentativeIndexFromList(const QList<QPersistentModelIndex>& list,
                                                                          const int sortKey)
{
    if (list.isEmpty())
    {
        return QPersistentModelIndex();
    }

    // first convert from QPersistentModelIndex to QModelIndex
    QList<QModelIndex> indexList;
    QModelIndex        bestIndex;

    for (int i=0; i < list.count(); ++i)
    {
        const QModelIndex newIndex(list.at(i));
        indexList.append(newIndex);
    }

    switch (d->application)
    {
        case MapWidgetView::ApplicationDigikam:
        {
            // now get the ImageInfos and convert them to GPSImageInfos
            const QList<ImageInfo> imageInfoList =  d->model->imageInfos(indexList);
            GPSImageInfo::List gpsImageInfoList;

            foreach(const ImageInfo& imageInfo, imageInfoList)
            {
                GPSImageInfo gpsImageInfo;

                if (ImagePropertiesSideBarDB::GPSImageInfofromImageInfo(imageInfo, &gpsImageInfo))
                {
                    gpsImageInfoList << gpsImageInfo;
                }
            }

            if (gpsImageInfoList.size()!=indexList.size())
            {
                // this is a problem, and unexpected
                return indexList.first();
            }

            // now determine the best available index
            bestIndex                     = indexList.first();
            GPSImageInfo bestGPSImageInfo = gpsImageInfoList.first();

            for (int i=1; i < gpsImageInfoList.count(); ++i)
            {
                const GPSImageInfo& currentInfo = gpsImageInfoList.at(i);

                if (GPSImageInfoSorter::fitsBetter(bestGPSImageInfo, GeoIface::SelectedNone,
                                                   currentInfo, GeoIface::SelectedNone,
                                                   GeoIface::SelectedNone, GPSImageInfoSorter::SortOptions(sortKey)))
                {
                    bestIndex        = indexList.at(i);
                    bestGPSImageInfo = currentInfo;
                }
            }

            break;
        }

        case MapWidgetView::ApplicationImportUI:
        {
            // now get the CamItemInfo and convert them to GPSImageInfos
            const QList<CamItemInfo> imageInfoList =  d->importModel->camItemInfos(indexList);
            GPSImageInfo::List       gpsImageInfoList;

            foreach(const CamItemInfo& imageInfo, imageInfoList)
            {
                const DMetadata meta(imageInfo.url().toLocalFile());
                double          lat, lng;
                const bool      hasCoordinates = meta.getGPSLatitudeNumber(&lat) && meta.getGPSLongitudeNumber(&lng);

                if (!hasCoordinates)
                {
                    continue;
                }

                GeoIface::GeoCoordinates coordinates(lat, lng);

                double alt;
                const bool haveAlt = meta.getGPSAltitude(&alt);

                if (haveAlt)
                {
                    coordinates.setAlt(alt);
                }

                GPSImageInfo gpsImageInfo;
                gpsImageInfo.coordinates = coordinates;
                gpsImageInfo.dateTime    = meta.getImageDateTime();
                gpsImageInfo.rating      = meta.getImageRating();
                gpsImageInfo.url         = imageInfo.url();
//.........这里部分代码省略.........
开发者ID:KDE,项目名称:digikam,代码行数:101,代码来源:mapwidgetview.cpp


注:本文中的DMetadata::getGPSLatitudeNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。