ArcGIS Runtime SDK for Qt

Feature layer change renderer

Loading

Code

import QtQuick 2.6
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Dialogs 1.2
import Esri.ArcGISRuntime 100.4
import Esri.ArcGISExtras 1.1

Rectangle {
    width: 800
    height: 600

    property real scaleFactor: System.displayScaleFactor

    // Map view UI presentation at top
    MapView {
        id: mapView

        anchors.fill: parent
        wrapAroundMode: Enums.WrapAroundModeDisabled

        Map {
            BasemapTopographic {}

            // create the feature layer
            FeatureLayer {
                id: featureLayer

                // feature table
                ServiceFeatureTable {
                    id: featureTable
                    url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/FeatureServer/0"
                }
            }

            onLoadStatusChanged: {
                if (loadStatus === Enums.LoadStatusLoaded) {
                    mapView.setViewpoint(viewPoint);
                }
            }
        }

        SimpleRenderer {
            id: renderer

            SimpleLineSymbol {
                style: Enums.SimpleLineSymbolStyleSolid
                color: "blue"
                antiAlias: true
                width: 2 * scaleFactor
            }
        }

        ViewpointExtent {
            id: viewPoint
            extent: Envelope {
                xMin: -13075816.4047166
                yMin: 4014771.46954516
                xMax: -13073005.6797177
                yMax: 4016869.78617381
                spatialReference: SpatialReference {
                    wkid: 102100
                }
            }
        }
    }

    Row {
        anchors {
            bottom: parent.bottom
            left: parent.left
            right: parent.right
            margins: 5 * scaleFactor
            bottomMargin: 25 * scaleFactor
        }
        spacing: 5

        // button to change renderer
        Button {
            text: "Change Renderer"
            enabled: featureTable.loadStatus === Enums.LoadStatusLoaded
            onClicked: {
                featureLayer.renderer = renderer;
            }
        }
    }
}


In this topic
  1. Code