×
Namespaces

Variants
Actions
Revision as of 02:00, 13 June 2012 by galazzo (Talk | contribs)

QAugmentedReality - Local based augmented reality component

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Nokia N8, Nokia C7-00
Compatibility
Platform(s):
Symbian
Platform Security
Capabilities: Location, NetworkServices,UserEnvironment,ReadUserData
Article
Keywords: Augmented Reality, Camera, GPS, Compass
Created: galazzo (13 Jun 2012)
Last edited: galazzo (13 Jun 2012)

Contents

Introduction

QAugmentedReality is a camera component that provides all functionalities to create your own local based augmented reality application like Nokia City Lens or social applications for example displaying your friends location or your parked car location direction.

Summary

The component built entirely from scratch, inherits all camera features adding GPS, Accelerometer and Compass support.
Anyway the component's strenght is the model support that allows you to easy manage your data to display. To add a pin into your scene you just need to add a QAugmentedRealityCameraItem element to QAugmentedRealityCameraModel to obtain a result like below:


Get Started with QAugmentedReality

  • Download the project from [projects.developer.nokia.com/QAugmentedReality here]
  • Include QAugmentedReality directory into your project

.pro

include(QAugmentedReality/AugmentedRealityLibrary.pri)

main.cpp

#include <QtGui/QApplication>
#include "qmlapplicationviewer.h"
 
#include <QtDeclarative>
#include "qaugmentedrealitycamera.h"
 
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QScopedPointer<QApplication> app(createApplication(argc, argv));
 
QmlApplicationViewer viewer;
 
qmlRegisterType<QAugmentedRealityCamera>("QAugmentedRealityCamera", 1, 0, "QAugmentedRealityCamera");
qmlRegisterType<QAugmentedRealityCameraModel>("QAugmentedRealityCamera", 1, 0, "QAugmentedRealityCameraModel");
qmlRegisterType<QAugmentedRealityCameraItem>("QAugmentedRealityCamera", 1, 0, "QAugmentedRealityCameraItem");
qmlRegisterType<QAugmentedRealityCameraDelegate>("QAugmentedRealityCamera", 1, 0, "QAugmentedRealityCameraDelegate");
 
// Resize the root QML element to view size
viewer.setResizeMode(QDeclarativeView::SizeRootObjectToView);
 
// Performance optimization flags
viewer.setAttribute(Qt::WA_OpaquePaintEvent);
viewer.setAttribute(Qt::WA_NoSystemBackground);
viewer.viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
viewer.viewport()->setAttribute(Qt::WA_NoSystemBackground);
viewer.setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
 
 
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);
viewer.setMainQmlFile(QLatin1String("qml/QAugmentedRealitySample/main.qml"));
viewer.showExpanded();
 
return app->exec();
}
147 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×