-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ccd500f
commit 2b8ddb4
Showing
1,004 changed files
with
26,002 additions
and
610 deletions.
There are no files selected for viewing
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
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
/build |
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,55 @@ | ||
# Add features with contingent values | ||
|
||
Create and add features whose attribute values satisfy a predefined set of contingencies. | ||
|
||
![Add features with contingent values](add-features-with-contingent-values.png) | ||
|
||
## Use case | ||
|
||
Contingent values are a data design feature that allow you to make values in one field dependent on values in another field. Your choice for a value on one field further constrains the domain values that can be placed on another field. In this way, contingent values enforce data integrity by applying additional constraints to reduce the number of valid field inputs. | ||
|
||
For example, a field crew working in a sensitive habitat area may be required to stay a certain distance away from occupied bird nests, but the size of that exclusion area differs depending on the bird's level of protection according to presiding laws. Surveyors can add points of bird nests in the work area and their selection of the size of the exclusion area will be contingent on the values in other attribute fields. | ||
|
||
## How to use the sample | ||
|
||
Tap on the map to add a feature symbolizing a bird's nest. Then choose values describing the nest's status, protection, and buffer size. Notice how different values are available depending on the values of preceding fields. Once the contingent values are validated, tap "Done" to add the feature to the map. | ||
|
||
## How it works | ||
|
||
1. Create and load the `Geodatabase` from the mobile geodatabase location on file. | ||
2. Load the first `GeodatabaseFeatureTable`. | ||
3. Load the `ContingentValuesDefinition` from the feature table. | ||
4. Create a new `FeatureLayer` from the feature table and add it to the map. | ||
5. Create a new `ArcGISFeature` using `GeodatabaseFeatureTable.createFeature()` | ||
6. Get the first field by name using `ArcGISFeatureTable.fields.find{ }`. | ||
7. Then get the `Field.domain` as an `CodedValueDomain`. | ||
8. Get the coded value domain's `codedValues` to get an array of `CodedValue`'s. | ||
9. After selecting a value from the initial coded values for the first field, retrieve the remaining valid contingent values for each field as you select the values for the attributes. | ||
i. Get the `ContingentValueResult`s by using `ArcGISFeatureTable.getContingentValues(ArcGISFeature, "field_name")` with the feature and the target field by name. | ||
ii. Get an array of valid `ContingentValues` from `ContingentValuesResult.contingentValuesByFieldGroup` dictionary with the name of the relevant field group. | ||
iii. Iterate through the array of valid contingent values to create an array of `ContingentCodedValue` names or the minimum and maximum values of a `ContingentRangeValue` depending on the type of `ContingentValue` returned. | ||
10. Validate the feature's contingent values by using `validateContingencyConstraints(feature)` with the current feature. If the resulting array is empty, the selected values are valid. | ||
|
||
## Relevant API | ||
|
||
* ArcGISFeatureTable | ||
* CodedValue | ||
* CodedValueDomain | ||
* ContingencyConstraintViolation | ||
* ContingentCodedValue | ||
* ContingentRangeValue | ||
* ContingentValuesDefinition | ||
* ContingentValuesResult | ||
|
||
## About the data | ||
|
||
This sample uses the [Contingent values birds nests](https://arcgis.com/home/item.html?id=e12b54ea799f4606a2712157cf9f6e41) mobile geodatabase and the [Fillmore topographic map](https://arcgis.com/home/item.html?id=b5106355f1634b8996e634c04b6a930a) vector tile package for the basemap. | ||
The mobile geodatabase contains birds nests in the Fillmore area, defined with contingent values. Each feature contains information about its status, protection, and buffer size. | ||
|
||
## Additional information | ||
|
||
Learn more about contingent values and how to utilize them on the [ArcGIS Pro documentation](https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/contingent-values.htm). | ||
|
||
## Tags | ||
|
||
coded values, contingent values, feature table, geodatabase |
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 @@ | ||
{ | ||
"category": "Edit and Manage Data", | ||
"description": "Create and add features whose attribute values satisfy a predefined set of contingencies.", | ||
"formal_name": "AddFeaturesWithContingentValues", | ||
"ignore": false, | ||
"images": [ | ||
"add-features-with-contingent-values.png" | ||
], | ||
"keywords": [ | ||
"coded values", | ||
"contingent values", | ||
"feature table", | ||
"geodatabase", | ||
"ArcGISFeatureTable", | ||
"CodedValue", | ||
"CodedValueDomain", | ||
"ContingencyConstraintViolation", | ||
"ContingentCodedValue", | ||
"ContingentRangeValue", | ||
"ContingentValuesDefinition", | ||
"ContingentValuesResult" | ||
], | ||
"language": "kotlin", | ||
"redirect_from": [ | ||
"/android/latest/sample-code/add-features-with-contingent-values.htm" | ||
], | ||
"relevant_apis": [ | ||
"ArcGISFeatureTable", | ||
"CodedValue", | ||
"CodedValueDomain", | ||
"ContingencyConstraintViolation", | ||
"ContingentCodedValue", | ||
"ContingentRangeValue", | ||
"ContingentValuesDefinition", | ||
"ContingentValuesResult" | ||
], | ||
"snippets": [ | ||
"src/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/MainActivity.kt", | ||
"src/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/DownloadActivity.kt" | ||
], | ||
"title": "Add features with contingent values" | ||
} |
Binary file added
BIN
+376 KB
add-features-with-contingent-values/add-features-with-contingent-values.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,36 @@ | ||
apply plugin: 'com.android.application' | ||
apply plugin: 'org.jetbrains.kotlin.android' | ||
|
||
android { | ||
compileSdkVersion rootProject.ext.compileSdkVersion | ||
|
||
defaultConfig { | ||
applicationId "com.esri.arcgismaps.sample.addfeatureswithcontingentvalues" | ||
minSdkVersion rootProject.ext.minSdkVersion | ||
targetSdkVersion rootProject.ext.targetSdkVersion | ||
versionCode rootProject.ext.versionCode | ||
versionName rootProject.ext.versionName | ||
buildConfigField("String", "API_KEY", API_KEY) | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
|
||
buildFeatures { | ||
dataBinding true | ||
} | ||
|
||
namespace 'com.esri.arcgismaps.sample.addfeatureswithcontingentvalues' | ||
} | ||
|
||
dependencies { | ||
// lib dependencies from rootProject build.gradle | ||
implementation "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion" | ||
implementation "com.google.android.material:material:$materialVersion" | ||
implementation project(path: ':samples-lib') | ||
implementation 'androidx.appcompat:appcompat:1.5.1' | ||
} |
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,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
35 changes: 35 additions & 0 deletions
35
add-features-with-contingent-values/src/main/AndroidManifest.xml
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 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name=".DownloadActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
|
||
<meta-data | ||
android:name="android.app.lib_name" | ||
android:value="" /> | ||
</activity> | ||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
Oops, something went wrong.