Skip to content

Commit

Permalink
Improve support for spatialinputactions
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasstein committed Jan 14, 2025
1 parent 3a95496 commit 40f1d1b
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 40 deletions.
10 changes: 9 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@
<type>pom</type>
<scope>test</scope>
</dependency>

<!-- devnet -->
<dependency>
<groupId>de.conterra.devnet</groupId>
<artifactId>mapapps-selection-actions</artifactId>
<version>1.14.0</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
Expand Down Expand Up @@ -431,7 +438,8 @@
<goal>deployAppTemplate</goal>
</goals>
<configuration>
<templateFile>${project.build.directory}/${project.artifactId}-sample-app.zip</templateFile>
<templateFile>
${project.build.directory}/${project.artifactId}-sample-app.zip</templateFile>
<templateResources>
<templateResource>
<directory>${js.build.outputPath}/apps/sample</directory>
Expand Down
81 changes: 80 additions & 1 deletion src/main/js/apps/sample_selectionactions/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,51 @@
}
]
},
"dn_selectionactions": {
"CircleSpatialInputWidgetModel": {
"enableDonut": true,
"minRadius": 0,
"maxRadius": 500,
"innerRadius": 0,
"outerRadius": 100,
"stepSize": 1,
"adjustStepSize": true,
"stepSizeRanges": [
{
"scaleRange": [
1,
100000
],
"stepSize": 1
},
{
"scaleRange": [
100000,
100000000
],
"stepSize": 100
}
],
"unit": "meters"
},
"AreaSelectSpatialInputWidgetModel": {
"buffer": 0,
"minBuffer": 0,
"maxBuffer": 5000,
"stepSize": 100,
"unit": "meters"
},
"GraphicSpatialInputWidgetModel": {
"buffer": 0,
"minBuffer": 0,
"maxBuffer": 5000,
"stepSize": 100,
"unit": "meters"
},
"MultiPointSpatialInputAction": {
"clickTolerance": 5
}
},
"banner": {
"BannerWidget": {
"label": "Developer Network",
Expand Down Expand Up @@ -362,7 +407,9 @@
"agssearch": {
"AutoStoreRegistration": {
"componentEnabled": true,
"useIn": ["querybuilder"]
"useIn": [
"querybuilder"
]
},
"AGSStore": [
{
Expand Down Expand Up @@ -483,6 +530,38 @@
"useIn": [
"querybuilder"
]
},
{
"id": "kreise",
"layerId": "kreise",
"title": "Kreise",
"description": "Kreise",
"fetchIdProperty": true,
"filterOptions": {
"suggestContains": true
},
"useIn": [
"search",
"selection",
"selection-actions-area"
],
"priority": 2,
"searchLabel": "kreis_name",
"searchAttribute": "kreis_name"
},
{
"id": "bundeslaender",
"url": "https://services.conterra.de/arcgis/rest/services/common/grenzen/FeatureServer/2",
"title": "Bundesländer",
"description": "Bundesländer",
"fetchIdProperty": true,
"filterOptions": {
"suggestContains": true
},
"priority": 1,
"useIn": [
"selection-actions-area"
]
}
]
},
Expand Down
85 changes: 47 additions & 38 deletions src/main/js/bundles/dn_querybuilder/QueryBuilderWidgetModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import ProjectParameters from "esri/rest/support/ProjectParameters";
const _replaceOpenedTablesBinding = Symbol("_spatialInputActionServiceBinding");
const _spatialInputActionServiceBinding = Symbol("_spatialInputActionServiceBinding");
const _spatialInputActionPromise = Symbol("_spatialInputActionPromise");
const _oldSpatialInputActionId = Symbol("_oldSpatialInputActionId");

export default declare({

Expand Down Expand Up @@ -82,48 +83,48 @@ export default declare({
metadataDelay: 500,
operators: {},
defaultOperators: {
default : {
default: {
codedvalue: [
{value: "$eq", text: "is"},
{value: "!$eq", text: "is_not"},
{value: "$gt", text: "is_greater_than"},
{value: "$gte", text: "is_greater_or_equal"},
{value: "$lt", text: "is_less_than"},
{value: "$lte", text: "is_less_or_equal"},
{value: "$exists", text: "exists"}
{ value: "$eq", text: "is" },
{ value: "!$eq", text: "is_not" },
{ value: "$gt", text: "is_greater_than" },
{ value: "$gte", text: "is_greater_or_equal" },
{ value: "$lt", text: "is_less_than" },
{ value: "$lte", text: "is_less_or_equal" },
{ value: "$exists", text: "exists" }
],
boolean: [
{value: "$eq", text: "is"},
{value: "!$eq", text: "is_not"},
{value: "$exists", text: "exists"}
{ value: "$eq", text: "is" },
{ value: "!$eq", text: "is_not" },
{ value: "$exists", text: "exists" }
],
string: [
{value: "$eq", text: "is"},
{value: "!$eq", text: "is_not"},
{value: "$eqw", text: "eqw"},
{value: "$suggest", text: "suggest"},
{value: "$exists", text: "exists"},
{value: "$in", text: "in"}
{ value: "$eq", text: "is" },
{ value: "!$eq", text: "is_not" },
{ value: "$eqw", text: "eqw" },
{ value: "$suggest", text: "suggest" },
{ value: "$exists", text: "exists" },
{ value: "$in", text: "in" }
],
number: [
{value: "$eq", text: "is"},
{value: "!$eq", text: "is_not"},
{value: "$gt", text: "is_greater_than"},
{value: "$gte", text: "is_greater_or_equal"},
{value: "$lt", text: "is_less_than"},
{value: "$lte", text: "is_less_or_equal"},
{value: "$exists", text: "exists"},
{value: "$in", text: "in"}
number: [
{ value: "$eq", text: "is" },
{ value: "!$eq", text: "is_not" },
{ value: "$gt", text: "is_greater_than" },
{ value: "$gte", text: "is_greater_or_equal" },
{ value: "$lt", text: "is_less_than" },
{ value: "$lte", text: "is_less_or_equal" },
{ value: "$exists", text: "exists" },
{ value: "$in", text: "in" }
],
date: [
{value: "$lte", text: "before"},
{value: "$gte", text: "after"},
{value: "$exists", text: "exists"}
{ value: "$lte", text: "before" },
{ value: "$gte", text: "after" },
{ value: "$exists", text: "exists" }
],
default: [
{value: "$eq", text: "is"},
{value: "!$eq", text: "is_not"},
{value: "$exists", text: "exists"}
{ value: "$eq", text: "is" },
{ value: "!$eq", text: "is_not" },
{ value: "$exists", text: "exists" }
]
}
},
Expand Down Expand Up @@ -206,17 +207,25 @@ export default declare({

selectSpatialInputAction(id) {
const spatialInputActionService = this._spatialInputActionService;
const oldSpatialInputAction = this[_spatialInputActionPromise];
if (oldSpatialInputAction) {
oldSpatialInputAction.cancel();
const oldSpatialInputActionPromise = this[_spatialInputActionPromise];
const oldSpatialInputActionId = this[_oldSpatialInputActionId];
if (oldSpatialInputActionPromise) {
oldSpatialInputActionPromise.cancel();
this[_spatialInputActionPromise] = null;
}
if (oldSpatialInputActionId) {
const oldSpatialInputAction = spatialInputActionService.getById(oldSpatialInputActionId);
oldSpatialInputAction.disable?.();
this[_oldSpatialInputActionId] = null;
}
if (!id) {
this.activeSpatialInputAction = null;
this.activeSpatialInputActionDescription = null;
return;
}
this[_oldSpatialInputActionId] = id;
const spatialInputAction = spatialInputActionService.getById(id);
spatialInputAction.enable?.();
const promise = this[_spatialInputActionPromise] = spatialInputAction.trigger({ queryBuilderSelection: true });
promise.then((geometry) => {
this.activeSpatialInputAction = null;
Expand Down Expand Up @@ -640,10 +649,10 @@ export default declare({
return;
},

prepareOperators(operators){
const completeOperators = {...this.defaultOperators};
prepareOperators(operators) {
const completeOperators = { ...this.defaultOperators };
Object.keys(operators).forEach(configuration => {
completeOperators[configuration] = {...this.defaultOperators.default};
completeOperators[configuration] = { ...this.defaultOperators.default };
Object.keys(operators[configuration]).forEach(type => {
completeOperators[configuration][type] = operators[configuration][type];
});
Expand Down

0 comments on commit 40f1d1b

Please sign in to comment.