Skip to content

Commit

Permalink
Merge pull request #181 from Esri/kous3106/SceneWidgetsSample
Browse files Browse the repository at this point in the history
Widgets sample for basic sceneview
  • Loading branch information
Michael Tims authored Jun 22, 2016
2 parents bf188e3 + edbdf06 commit 2ccdca3
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// [WriteFile Name=BasicSceneView, Category=Scenes]
// [Legal]
// Copyright 2015 Esri.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// [Legal]

#include "BasicSceneView.h"
#include "Scene.h"
#include "SceneGraphicsView.h"
#include "ArcGISTiledElevationSource.h"
#include "Camera.h"
#include <QVBoxLayout>

using namespace Esri::ArcGISRuntime;

BasicSceneView::BasicSceneView(QWidget* parent) :
QWidget(parent)
{
// Create a scene using the Imagery basemap
m_scene = new Scene(Basemap::imagery(this), this);

// Create a scene view, and pass in the scene
m_sceneView = new SceneGraphicsView(m_scene, this);

// create an elevation source
ArcGISTiledElevationSource* elevationSource = new ArcGISTiledElevationSource(QUrl("http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"), this);
m_scene->baseSurface()->elevationSources()->append(elevationSource);

// create a camera
Camera camera(28.4, 83.9, 10010.0, 10.0, 80.0, 300.0);
// set the viewpoint to the camera
m_sceneView->setViewpointCamera(camera);

// Set up the UI
QVBoxLayout *vBoxLayout = new QVBoxLayout(this);
vBoxLayout->addWidget(m_sceneView);
setLayout(vBoxLayout);
}

BasicSceneView::~BasicSceneView()
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// [WriteFile Name=BasicSceneView, Category=Scenes]
// [Legal]
// Copyright 2015 Esri.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// [Legal]

#ifndef BASIC_SCENEVIEW_H
#define BASIC_SCENEVIEW_H

namespace Esri {
namespace ArcGISRuntime {
class Scene;
class SceneGraphicsView;
}
}

#include <QWidget>

class BasicSceneView : public QWidget
{
Q_OBJECT

public:
explicit BasicSceneView(QWidget* parent = 0);
~BasicSceneView();

private:
Esri::ArcGISRuntime::Scene* m_scene;
Esri::ArcGISRuntime::SceneGraphicsView* m_sceneView;
};

#endif // BASIC_SCENEVIEW_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#-------------------------------------------------
# Copyright 2015 Esri.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------

mac {
cache()
}

CONFIG += c++11 esri_runtime_qt100_0_0

QT += core gui opengl xml network positioning sensors

win32:CONFIG += \
embed_manifest_exe

TARGET = BasicSceneView
TEMPLATE = app

SOURCES += \
main.cpp \
BasicSceneView.cpp

HEADERS += \
BasicSceneView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2015 Esri.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "BasicSceneView.h"
#include <QApplication>
#include <QMessageBox>

int main(int argc, char *argv[])
{
QApplication application(argc, argv);

#ifdef Q_OS_WIN
// Force usage of OpenGL ES through ANGLE on Windows
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
#endif

BasicSceneView applicationWindow;
applicationWindow.setMinimumWidth(800);
applicationWindow.setMinimumHeight(600);
applicationWindow.show();

return application.exec();
}

0 comments on commit 2ccdca3

Please sign in to comment.