-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #181 from Esri/kous3106/SceneWidgetsSample
Widgets sample for basic sceneview
- Loading branch information
Showing
4 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
ArcGISRuntimeSDKQt_CppSamples_Widgets/Scenes/BasicSceneView/BasicSceneView.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
{ | ||
} |
42 changes: 42 additions & 0 deletions
42
ArcGISRuntimeSDKQt_CppSamples_Widgets/Scenes/BasicSceneView/BasicSceneView.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
35 changes: 35 additions & 0 deletions
35
ArcGISRuntimeSDKQt_CppSamples_Widgets/Scenes/BasicSceneView/BasicSceneView.pro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
33 changes: 33 additions & 0 deletions
33
ArcGISRuntimeSDKQt_CppSamples_Widgets/Scenes/BasicSceneView/main.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |