Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master #16

Open
wants to merge 6 commits into
base: v3.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions Feature Layer (Shapefile)/MyApp.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/* Copyright 2017 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.
*
*/

import QtQuick 2.7
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.1
import QtQuick.Controls.Material 2.1
import QtGraphicalEffects 1.0

import ArcGIS.AppFramework 1.0
import ArcGIS.AppFramework.Controls 1.0
import Esri.ArcGISRuntime 100.2

import "controls" as Controls

App {
id: app
width: 414
height: 736
function units(value) {
return AppFramework.displayScaleFactor * value
}
property real scaleFactor: AppFramework.displayScaleFactor
property int baseFontSize : app.info.propertyValue("baseFontSize", 15 * scaleFactor) + (isSmallScreen ? 0 : 3)
property bool isSmallScreen: (width || height) < units(400)

property string dataPath: AppFramework.userHomeFolder.filePath("ArcGIS/AppStudio/Data/Shapefile")

property FileFolder sourceFolder: app.folder.folder("data/Shapefile")
property FileFolder destFolder: AppFramework.userHomeFolder.folder("ArcGIS/AppStudio/Data/Shapefile")

function copyLocalData() {
if(!destFolder.exists)
AppFramework.userHomeFolder.makePath(dataPath);
var filesList = sourceFolder.fileNames()
for(var i =0; i < sourceFolder.fileNames().length; i++)
{
if(!destFolder.fileExists(filesList[i]))
sourceFolder.copyFile(filesList[i], dataPath + "/" + filesList[i]);
}
}

Page{
anchors.fill: parent
header: ToolBar{
id:header
width: parent.width
height: 50 * scaleFactor
Material.background: "#8f499c"
Controls.HeaderBar{}
}

// sample starts here ------------------------------------------------------------------
contentItem: Rectangle{
anchors.top:header.bottom

MapView {
id: mapView
anchors.fill: parent

Map {
id: map
BasemapStreetsVector {}

FeatureLayer {

ShapefileFeatureTable {
id:shpTable

path: AppFramework.userHomeFolder.fileUrl(dataPath + "/Public_Art.shp")
}

onLoadStatusChanged: {
if (loadStatus !== Enums.LoadStatusLoaded)
return;

mapView.setViewpointCenterAndScale(fullExtent.center, 80000);
}
}
}
}
}
}

// sample ends here ------------------------------------------------------------------------
Controls.DescriptionPage{
id:descPage
visible: false
}

Component.onCompleted: {
copyLocalData()
}
}

32 changes: 32 additions & 0 deletions Feature Layer (Shapefile)/MyApp.qmlproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//------------------------------------------------------------------------------

import QmlProject 1.1

Project {
mainFile: "MyApp.qml"

QmlFiles {
directory: "."
recursive: true
}

JavaScriptFiles {
directory: "."
recursive: true
}

ImageFiles {
directory: "."
recursive: true
}

Files {
directory: "."
recursive: true
filter: "*.json;*.html;*.txt"
}

importPaths: [
]
}

43 changes: 43 additions & 0 deletions Feature Layer (Shapefile)/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## Feature Layer (Shapefile)

This sample demonstrates how to open a shapefile stored on the device and display it as a feature layer with default symbology. The shapefile will be downloaded from an ArcGIS Online portal automatically.

A ShapefileFeatureTable is created using the path to a shapefile (.shp) on the file system. The ShapefileFeatureTable is then used to create a FeatureLayer. The FeatureLayer is added to the map as an operational layer, using default symbology and rendering.

[Resource Level](https://geonet.esri.com/groups/appstudio/blog/2016/12/06/how-to-describe-our-resources-in-terms-of-difficulty-complexity-and-time-to-digest): 🍌


## Instructions to run this sample in AppStudio Desktop

1. Download the `.zip` file
2. Unzip and copy this folder into AppStudio Apps folder (Windows: `C:\Users\<username>\ArcGIS\AppStudio\Apps` Mac or linux: `Home\ArcGIS\AppStudio\Apps`)
3. The new app will now appear in the AppStudio Desktop. Run the application or open it in the bundled Qt-Creator IDE to look at the code and modify.

## Issues

Find a bug or want to request a new feature? Please let us know by submitting an issue.

## Contributing

Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](https://github.com/esri/contributing).

## Licensing
Copyright 2017 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.

A copy of the license is available in the repository's [license.txt](license.txt) file.


[](Esri Tags: ArcGIS Runtime SDK Qt QML JavaScript iOS Android Xamarin Ionic PhoneGap Mac linux Windows Apps samples templates appstudio)
[](Esri Language: Qt QML JavaScript)
Binary file added Feature Layer (Shapefile)/appicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
89 changes: 89 additions & 0 deletions Feature Layer (Shapefile)/appinfo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"arcgisRuntime": 1002,
"capabilities": {
"audio": false,
"backgroundLocation": false,
"biometricAuthentication": false,
"bluetooth": false,
"camera": false,
"fileSharing": false,
"highAccuracyLocation": false,
"ios": {
"externalAccessoryProtocolStrings": [
]
},
"localnotification": false,
"location": true,
"microphone": false,
"network": true,
"storage": false,
"vibration": false
},
"deployment": {
"android": {
"packageName": ""
},
"arcgisRuntimeExtensionsLicense": "",
"arcgisRuntimeLicense": "",
"clientId": "",
"ios": {
"bundleId": "",
"codeSignIdentity": ""
},
"macos": {
"bundleId": "",
"codeSignIdentity": ""
},
"publisherName": "",
"uwp": {
"packageName": "",
"productID": ""
},
"winphone": {
"packageDisplayName": ""
}
},
"devicesTypes": [
"desktop",
"tablet",
"phone"
],
"display": {
"desktop": {
"minimumHeight": 0,
"minimumWidth": 0,
"windowMode": "default"
},
"phone": {
"landscape": true,
"portrait": true,
"showStatusBar": true
},
"tablet": {
"landscape": true,
"portrait": true,
"showStatusBar": true
}
},
"environment": {
},
"launchUrlSchemes": [
],
"mainFile": "MyApp.qml",
"multipleInstances": true,
"projectFile": "MyApp.qmlproject",
"properties": {
},
"resources": {
"appIcon": "default-app.png",
"launchImageBackground": "launchimage-background.png",
"launchImageBackgroundColor": "#ffffff",
"launchImageOverlay": "launchimage-overlay.png"
},
"type": "app",
"urlScheme": "",
"version": {
"major": 1,
"micro": 1
}
}
Binary file added Feature Layer (Shapefile)/assets/clear.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Feature Layer (Shapefile)/assets/info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
93 changes: 93 additions & 0 deletions Feature Layer (Shapefile)/controls/DescriptionPage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.1

import ArcGIS.AppFramework 1.0
import ArcGIS.AppFramework.Controls 1.0

Item {
id: descPage
width: parent.width
height: parent.height

Rectangle{
anchors.fill:parent

ColumnLayout{
anchors.fill:parent
spacing: 0
clip:true

Rectangle{
id:descPageheader
color:"#8f499c"
Layout.preferredWidth: parent.width
Layout.preferredHeight: 50 * scaleFactor

ImageButton {
source: "../assets/clear.png"
height: 30 * scaleFactor
width: 30 * scaleFactor
checkedColor : "transparent"
pressedColor : "transparent"
hoverColor : "transparent"
glowColor : "transparent"
anchors {
right: parent.right
rightMargin: 10 * scaleFactor
verticalCenter: parent.verticalCenter
}
onClicked: {
descPage.visible = 0
}
}

Text {
id: aboutApp
text:qsTr("About")
color:"white"
font.pixelSize: app.baseFontSize * 1.1
font.bold: true
anchors.centerIn: parent
maximumLineCount: 2
elide: Text.ElideRight
}
}

Rectangle{
color:"black"
Layout.fillWidth: true
Layout.fillHeight: true

Flickable {
anchors.fill:parent
contentHeight: descText.height
clip:true

Text{
id: descText
y: 30 * scaleFactor
text:app.info.description
anchors.horizontalCenterOffset: 0
color:"white"
width: 0.85 * parent.width
horizontalAlignment: Text.AlignLeft
linkColor: "#e5e6e7"
wrapMode: Text.WordWrap
elide: Text.ElideRight
anchors.horizontalCenter: parent.horizontalCenter
font {
pixelSize: app.baseFontSize
}
onLinkActivated: Qt.openUrlExternally(link)
}
}
}
}
}
}





Loading