Scene layer selection

View inQMLC++
View on GitHub
Sample viewer app

Identify features in a scene to select.

screenshot

Use case

You can select features to visually distinguish them with a selection color or highlighting. This can be useful to demonstrate the physical extent or associated attributes of a feature, or to initiate another action such as centering that feature in the scene view.

How to use the sample

Click on a building in the scene layer to select it. Deselect buildings by clicking away from the buildings.

How it works

  1. Create an ArcGISSceneLayer passing in the URL to a scene layer service.
  2. Use SceneView::mouseClicked signal to get the screen tap location screenPoint.
  3. Call SceneView::identifyLayer to identify features in the scene that intersect the tapped screen point.
  4. From the resulting IdentifyLayerResult, a list of identified GeoElements are obtained.
  5. Get the first element in the list, checking that it is a feature, and call ArcGISSceneLayer::selectFeature(feature) to select it.

Relevant API

  • ArcGISSceneLayer
  • Scene
  • SceneView

About the data

This sample shows a Berlin, Germany Scene hosted on ArcGIS Online.

Tags

3D, Berlin, buildings, identify, model, query, search, select

Sample Code

SceneLayerSelection.qmlSceneLayerSelection.cppSceneLayerSelection.h
                               
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// [WriteFile Name=SceneLayerSelection, Category=Scenes]
// [Legal]
// Copyright 2018 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]

import QtQuick 2.6
import QtQuick.Controls 2.2
import Esri.Samples 1.0

SceneLayerSelectionSample {
    id: rootRectangle
    clip: true
    width: 800
    height: 600

    SceneView {
        objectName: "sceneView"
        anchors.fill: parent
    }
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.