Skip to main content

Difficulty with enabling snapping.

Comments

14 comments

  • Official comment
    Gareth Evans

     Good news everyone!

    TLDR: VSW 5.28 resolved an issue with the Workflow-based Geometry Picker. I took the time to put an example application together here: https://apps.vertigisstudio.com/web/?app=627038c244134dad84dfe3cac4c9ae60

    Looks like this:

    Details:

    • VSW 5.28 resolved an outstanding issue (bug 240218) where snapping was not working correctly on the Geometry Picker from Workflow
    • This app is meant to be a demonstration of how you might open an app with snapping disabled, then enable it via a button. Snapping is disabled in the app globally by default.
    • The app consists of the Default Web GIS template configured with a toggle button that uses sketching.activate-snapping and sketching.deactivate-snapping to toggle snapping state, and a Geometry Picker that is activated by default to demonstrate it being influenced by that application state.
    • Note that if you wanted snapping to default to on, you could use sketching.activate-snapping in the Map Initialized event to enable it as the app starts up.

    Instructions:

    1. Load app, Geometry Picker activates by default. Hover over map: note there is no snapping.
    2. Click Enable Snapping button to toggle on snapping (or via the Draw menu!).
    3. Hover over map over any feature, note that snapping to features now occurs.
    4. Celebrate & use this in your own applications!
       

    For more detail, you can see the two items used:

    To your point Alan Clack, the geometry picker should be honouring sketching properties. If you continue to see issues here, I would ask about the version of VSW you are using. If it is 5.27 or earlier, I would consider updating to the latest (5.29 as of this writing).

  • Andrew Adamson

    What version of Web are you on?  Looks like snapping was added @ 5.21 - 4 January 2023

    2
  • Permanently deleted user

    Andrew Adamson

    What version of Web are you on?  Looks like snapping was added @ 5.21 - 4 January 2023


    My apologies, this may be on the wrong section. I thought I had posted to Studio.

    I believe the screenshot above shows the VertiGIS Studio Workflow Version 5.27.1. I'm not aware if the versions are separate usually. I updated the post to be under Studio Workflow, which I assume is 5.27.1.

    0
  • Gareth Evans

    Hey @... are you running your workflow inside a VertiGIS Studio Web (VSW) app? The snapping we mention here is specific to VSW, it isn't configured at the workflow level.

    I haven't yet used snapping in the context of a geometry picker, but if you like I can give it a shot and provide an example.

    3
  • Permanently deleted user

    Thanks for the response @.... I'll try to include as much information as I can.

    The workflows do have "VertiGIS Studio Web" checked in the Deployment tab.
    So I'm going to assume the design will include activities/commands allowed in VertiGIS Studio Web.

    I can run other commands utilizing the Run Command Activity such as:
    ui.alert
    geolocation.get-position
    etc...

    with expected results...

    However, when I try to run:
    sketching.activate-snapping
    I get the error that it is an unknown command (with the above screenshot). Perhaps I'm just misunderstanding when commands can and cannot be run in VertiGIS Studio Web (VSW)?

    My ultimate goal is to simply start the sketching (or whatever it may be called) when you start to draw graphics with the Geometry Picker activity. That way the user can "snap" to already exist features as they draw these graphics.

    I have found some acceptable work arounds in the meantime, but future tools could be a lot cleaner with built-in snapping options. Thanks for any support you can provide!


    1
  • Zack Robison

    Studio is an umbrella that includes Workflow (where we're posting) and Web.  VertiGIS Studio Web is the primary Web App designer which you presumably are migrating to from Geocortex Essentials.  Knowing the Workflow deployment (the checkbox you mentioned) is helpful, but what we really are asking about is the version of the Web app that you are running, for example:

    Looks like you are trying to run this command in Web, but it could be in Mobile.  If it's Web, then you may need to upgrade your viewer since they just added snapping in January.  Then you'll see messages more like this:

    If you're trying to run this in mobile, then you'll probably need those workarounds for a little while longer.  If you were trying to run them anywhere else, ui.alert would not have worked for you; so we can rule that out!

    1
  • Permanently deleted user

    Thank you everyone. Appreciate the patience and my apologies for the difficulty in picking up on the different components and their versions. The issue is that I do, in fact, not have a version with snapping.

    Zack Robison, thanks especially for the screen shot as that helped determine exactly what and where I was supposed to be looking. Turns out we still have an older version:

    Easy fix for a backlog item later. Thanks again guys!

    0
  • Rohan Christopherson

    Hi guys

    To add to this thread, I'm currently having difficulty activating snapping using the workflow geometry picker. Using SaaS products, so 5.22.2 Web and 5.32.0 Workflow, if I enable snapping it works using the drawing tools within web but not the geometry picker within the workflow. Anyone know how to enable it?

    Thanks

    0
  • Wouter Hajnal

    Hi @..., could you provide an example in which you can use snapping while using the GeometryPicker? I haven't managed to make it work in that context, while I did using the sketching.capture-geometry command (see picture).

    1
  • Zofia Dudziuk

    Hi All, I would like to echo the request for an example of geometry picker with activated snapping. I am experiencing the same issue as Rohan Christopherson, snapping works while using drawing tools within web, but not when using geometry picker within workflow (using Saas, web 5.23.0  and workflow 5.33.1).

    Thanks

    0
  • Alan Clack

    The below workaround only has value if the VertiGIS Web Studio is below version 5.28 with an extreme recommendation to utilize a newer version as a fix.

    I was the original poster for this (my account had an error). We did get an update recently so the modules needed were added, but it does appear that Geometry Picker doesn't honor any of the sketching properties during its sketching process. So I shambled together a bit of a mess, but something that does get the functionality our users needed.
    I hope that you guys update the Geometry Picker sketching components to honor other sketching properties or at least the option to looks like most of it is setup, just no options to enable!
    I know its been a bit for:
    Rohan Christopherson
    Zofia Dudziuk

    Here is the code from an exported .json file.

    {"_properties":{"isServerWorkflow":false},"components":[{"id":2,"steps":[{"id":3,"inputs":{},"position":"0,0","purpose":"start","title":"Start","transitions":[{"id":59,"inputs":{},"position":"90,60 90,90","sourceConnector":"bottom","target":{"id":56},"targetConnector":"top"}]},{"action":"gcx:wf:core::Container","id":56,"inputs":{},"position":"-30,90","title":"Initialize Info","transitions":[{"id":1011,"inputs":{},"position":"90,180 90,220","sourceConnector":"bottom","target":{"id":942},"targetConnector":"top"}]},{"action":"gcx:wf:core::Exit","id":607,"inputs":{},"position":"0,380","title":"Exit"},{"action":"gcx:wf:core::Annotation","description":"The goal of this form is to display a geometry picker that works with snapping by using built-in sketching modules. As such an \"add on button\" was created to handle the logic and a large amount of other business logic is included to reproduce how an original Geometry Picker would work.\n\nLower level error catching isn't built-in here *(such as a polygon sketch with only 2 vertices)*. Otherwise many options to utilize original Geometry Picker objects helps until snapping becomes enabled for the Geometry Picker sketching.\n\nEditing January 30, 2024","id":703,"inputs":{},"position":"220,0","title":"Notes"},{"action":"gcx:wf:forms:form:DisplayForm","id":942,"inputs":{"form":{"accessors":[],"code":"resources.forms[values.id]","values":{"id":934}}},"name":"formSnappingGeometryPicker","position":"-30,220","title":"Snapping Geometry Picker","transitions":[{"id":700,"position":"90,340 90,380","sourceConnector":"bottom","target":{"id":607},"targetConnector":"top"}]}]},{"id":8,"steps":[{"id":16,"inputs":{},"position":"0,260","purpose":"start","title":"Container","transitions":[{"id":698,"position":"90,320 90,360","sourceConnector":"bottom","target":{"id":658},"targetConnector":"top"}]},{"action":"gcx:wf:app::RunCommand","id":135,"inputs":{"commandName":"sketching.activate-snapping"},"position":"-30,580","title":"sketching.activate-snapping","transitions":[{"id":737,"position":"90,610 90,650","sourceConnector":"bottom","target":{"id":736},"targetConnector":"top"}]},{"action":"gcx:wf:core::CreateValue","id":658,"inputs":{},"name":"valueMaxGeometries","position":"-30,360","title":"Create Value","transitions":[{"id":717,"position":"90,430 90,470","sourceConnector":"bottom","target":{"id":716},"targetConnector":"top"}]},{"action":"gcx:wf:core::Annotation","description":"This is needed to share information between Geometry Picker and the Add On button to support tracking max/type geometries appropriately.","id":661,"inputs":{},"position":"220,360","title":"valueMaxGeometries"},{"action":"gcx:wf:core::CreateValue","id":716,"inputs":{},"name":"valueGeometryType","position":"-30,470","title":"Create Value","transitions":[{"id":718,"position":"90,540 90,580","sourceConnector":"bottom","target":{"id":135},"targetConnector":"top"}]},{"action":"gcx:wf:app::RunCommand","id":736,"inputs":{"commandName":"map.clear-markup"},"position":"-30,650","title":"map.clear-markup"}]},{"id":108,"steps":[{"id":109,"inputs":{},"position":"0,150","purpose":"start","title":"Event","transitions":[{"id":565,"position":"90,210 90,250","sourceConnector":"bottom","target":{"id":231},"targetConnector":"top"}]},{"action":"gcx:wf:core::CreateValue","id":145,"inputs":{"expression":{"accessors":["$runOperationCaptureGeometry"],"annotations":[{"count":28,"index":0,"kind":"idref"}],"code":"$runOperationCaptureGeometry.result.geometry","source":"$runOperationCaptureGeometry.result.geometry"}},"name":"valueSketchGeometry","position":"-30,430","title":"Create Value","transitions":[{"id":150,"position":"90,500 90,540","sourceConnector":"bottom","target":{"id":149},"targetConnector":"top"}]},{"action":"gcx:wf:core::CreateValue","id":149,"inputs":{"expression":{"accessors":["$runOperationCaptureGeometry"],"annotations":[{"count":28,"index":31,"kind":"idref"}],"code":"{\n    pending: false,\n    content: $runOperationCaptureGeometry.result.geometry\n}","source":"{\n  pending: false,\n  content: $runOperationCaptureGeometry.result.geometry\n}"}},"name":"valueSketchGeometryState","position":"-30,540","title":"Create Value","transitions":[{"id":224,"position":"90,610 90,650","sourceConnector":"bottom","target":{"id":184},"targetConnector":"top"}]},{"action":"gcx:wf:core::If","description":"If `value` is `undefined`:\\\n**`true:`** There are no geometries and we can't execute logic. Handle the array differently by simply inserting the geometry.\n**`false:`** Add the geometry to the already existing array.","id":179,"inputs":{"condition":{"accessors":["$formSnappingGeometryPicker"],"annotations":[{"count":27,"index":0,"kind":"idref"}],"code":"$formSnappingGeometryPicker.state.geometryPicker.value === undefined","source":"$formSnappingGeometryPicker.state.geometryPicker.value === undefined"}},"position":"-30,760","title":"If value = undefined","transitions":[{"branch":"true","id":183,"position":"-30,865 -70,865 -70,1010","sourceConnector":"left","target":{"id":192},"targetConnector":"top"},{"branch":"false","id":211,"position":"210,865 250,865 250,1010","sourceConnector":"right","target":{"id":210},"targetConnector":"top"}]},{"action":"gcx:wf:core::CreateValue","id":184,"inputs":{"expression":{"accessors":["$formSnappingGeometryPicker","$valueSketchGeometryState"],"annotations":[{"count":27,"index":0,"kind":"idref"},{"count":25,"index":63,"kind":"idref"}],"code":"$formSnappingGeometryPicker.state.geometryPicker.state.unshift($valueSketchGeometryState.result)","source":"$formSnappingGeometryPicker.state.geometryPicker.state.unshift($valueSketchGeometryState.result)"}},"name":"valueStateArray","position":"-30,650","title":"Create Value","transitions":[{"id":232,"position":"90,720 90,760","sourceConnector":"bottom","target":{"id":179},"targetConnector":"top"}]},{"action":"gcx:wf:core::CreateValue","id":192,"inputs":{"expression":{"accessors":["$runOperationCaptureGeometry"],"annotations":[{"count":28,"index":1,"kind":"idref"}],"code":"[$runOperationCaptureGeometry.result.geometry]","source":"[$runOperationCaptureGeometry.result.geometry]"}},"name":"valueCreateGeometryPickerGeometryArray","position":"-190,1010","title":"Create Value","transitions":[{"id":198,"position":"-70,1080 -70,1120","sourceConnector":"bottom","target":{"id":197},"targetConnector":"top"}]},{"action":"gcx:wf:core::CreateValue","id":197,"inputs":{"expression":{"accessors":["$valueGeometryType","$valueCreateGeometryPickerGeometryArray"],"annotations":[{"count":18,"index":43,"kind":"idref"},{"count":39,"index":83,"kind":"idref"}],"code":"{\n    refValueType: \"geometry\",\n    format: $valueGeometryType.result,\n    geometry: $valueCreateGeometryPickerGeometryArray.result\n}","source":"{\n    refValueType: \"geometry\",\n    format:$valueGeometryType.result,\n    geometry:$valueCreateGeometryPickerGeometryArray.result\n}"}},"name":"valueCreateGeometryPickerValueObject","position":"-190,1120","title":"Create Value","transitions":[{"id":206,"position":"-70,1190 -70,1230","sourceConnector":"bottom","target":{"id":205},"targetConnector":"top"}]},{"action":"gcx:wf:core::SetProperty","id":205,"inputs":{"object":{"accessors":["$formSnappingGeometryPicker"],"annotations":[{"count":27,"index":0,"kind":"idref"}],"code":"$formSnappingGeometryPicker.state.geometryPicker","source":"$formSnappingGeometryPicker.state.geometryPicker"},"propertyName":"value","propertyValue":{"accessors":["$valueCreateGeometryPickerValueObject"],"annotations":[{"count":37,"index":0,"kind":"idref"}],"code":"$valueCreateGeometryPickerValueObject.result","source":"$valueCreateGeometryPickerValueObject.result"}},"position":"-190,1230","title":"Set Property","transitions":[{"id":648,"position":"-70,1260 -70,1280 100,1280 100,1300","sourceConnector":"bottom","target":{"id":654},"targetConnector":"top"}]},{"action":"gcx:wf:core::CreateValue","id":210,"inputs":{"expression":{"accessors":["$formSnappingGeometryPicker","$runOperationCaptureGeometry"],"annotations":[{"count":27,"index":0,"kind":"idref"},{"count":28,"index":69,"kind":"idref"}],"code":"$formSnappingGeometryPicker.state.geometryPicker.value.geometry.push($runOperationCaptureGeometry.result.geometry)","source":"$formSnappingGeometryPicker.state.geometryPicker.value.geometry.push($runOperationCaptureGeometry.result.geometry)"}},"name":"valueUpdateValueArray","position":"130,1010","title":"Create Value","transitions":[{"id":649,"position":"250,1080 250,1280 100,1280 100,1300","sourceConnector":"bottom","target":{"id":654},"targetConnector":"top"}]},{"action":"gcx:wf:forms::ShowFormElement","id":231,"inputs":{"elementName":{"accessors":["$formSnappingGeometryPicker"],"annotations":[{"count":27,"index":0,"kind":"idref"}],"code":"$formSnappingGeometryPicker.state.geometryPicker","source":"$formSnappingGeometryPicker.state.geometryPicker"},"form":{"accessors":["$$form"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$$form","source":"$$form"},"visible":true},"position":"-30,250","title":"Show Form Element","transitions":[{"id":773,"position":"90,280 90,320","sourceConnector":"bottom","target":{"id":770},"targetConnector":"top"}]},{"action":"gcx:wf:core::Container","description":"empty","id":501,"inputs":{},"name":"containerGeometryPickerAddOnLogic","position":"-20,1570","title":"Container"},{"action":"gcx:wf:core::Container","description":"Logic to ensure the Max Geometries from the geometry picker is maintained.","id":586,"inputs":{},"position":"-20,1370","title":"Container","transitions":[{"id":697,"position":"100,1530 100,1570","sourceConnector":"bottom","target":{"id":501},"targetConnector":"top"}]},{"action":"gcx:wf:core::SetProperty","id":654,"inputs":{"object":{"accessors":["$formSnappingGeometryPicker"],"annotations":[{"count":27,"index":0,"kind":"idref"}],"code":"$formSnappingGeometryPicker.state.geometryPicker","source":"$formSnappingGeometryPicker.state.geometryPicker"},"propertyName":"size","propertyValue":{"accessors":["$formSnappingGeometryPicker"],"annotations":[{"count":27,"index":0,"kind":"idref"}],"code":"$formSnappingGeometryPicker.state.geometryPicker.value.geometry.length","source":"$formSnappingGeometryPicker.state.geometryPicker.value.geometry.length"}},"position":"-20,1300","title":"Set Property","transitions":[{"id":655,"position":"100,1330 100,1370","sourceConnector":"bottom","target":{"id":586},"targetConnector":"top"}]},{"action":"gcx:wf:core::Annotation","description":"The major downside to an \"add on button\" is that you may need to duplicate logic that your Geometry Picker would handle for its events such as `on-change` or `validation`.\n\nYou may have to maintain this logic here and in the Picker `on-change` logic.. or trigger that element's event, but I can't find a way to do that currently.","id":707,"inputs":{},"position":"230,1570","title":"Notes"},{"action":"gcx:wf:app::RunOperation","id":770,"inputs":{"operationName":"sketching.capture-geometry","operationParameter":{"accessors":["$valueGeometryType"],"annotations":[{"count":18,"index":18,"kind":"idref"}],"code":"{\n    geometryType: $valueGeometryType.result,\n    disableFreehand: true,\n    pluginSettings: {\n        snapping: true\n    }\n}","source":"{\n  geometryType: $valueGeometryType.result,\n  disableFreehand: true,\n  pluginSettings:{\n        snapping: true\n      }\n}"}},"name":"runOperationCaptureGeometry","position":"-30,320","title":"Run Operation","transitions":[{"id":774,"position":"90,390 90,430","sourceConnector":"bottom","target":{"id":145},"targetConnector":"top"}]},{"action":"gcx:wf:core::Annotation","description":"Start capturing geometry. Will support all operations that default Geometry Picker is missing *(such as snapping)* through the [parameters](https://developers.vertigisstudio.com/docs/web/api-commands-operations-events/#definition-CaptureGeometryResult).\n\n**Low levels errors with sketching kill the workflow sadly.**","id":772,"inputs":{},"position":"220,320","title":"runOperationCaptureGeometry"}],"title":"click-buttonBarGeometryPickerAddOn"},{"id":116,"steps":[{"id":117,"inputs":{},"position":"0,0","purpose":"start","title":"Event","transitions":[{"id":121,"position":"90,60 90,100","sourceConnector":"bottom","target":{"id":119},"targetConnector":"top"}]},{"action":"gcx:wf:core::If","id":119,"inputs":{"condition":{"accessors":["$formSnappingGeometryPicker"],"annotations":[{"count":27,"index":0,"kind":"idref"}],"code":"$formSnappingGeometryPicker.state.checkBoxSnapping.checked","source":"$formSnappingGeometryPicker.state.checkBoxSnapping.checked"}},"position":"30,100","title":"If","transitions":[{"branch":"false","id":126,"position":"150,130 250,130 250,200","sourceConnector":"right","target":{"id":125},"targetConnector":"top"},{"branch":"true","id":127,"position":"30,130 -70,130 -70,200","sourceConnector":"left","target":{"id":122},"targetConnector":"top"}]},{"action":"gcx:wf:app::RunCommand","id":122,"inputs":{"commandName":"sketching.activate-snapping"},"position":"-190,200","title":"Run Command"},{"action":"gcx:wf:app::RunCommand","id":125,"inputs":{"commandName":"sketching.deactivate-snapping"},"position":"130,200","title":"Run Command"},{"action":"gcx:wf:core::Annotation","description":"Turn snapping on/off.","id":702,"inputs":{},"position":"190,0","title":"Notes"}],"title":"change-checkBoxSnapping"},{"id":369,"steps":[{"id":370,"inputs":{},"position":"0,-10","purpose":"start","title":"Container"}]},{"id":440,"steps":[{"id":442,"inputs":{},"position":"0,-10","purpose":"start","title":"Container"}]},{"id":532,"steps":[{"id":534,"inputs":{},"position":"0,0","purpose":"start","title":"Event","transitions":[{"id":539,"position":"90,60 90,100","sourceConnector":"bottom","target":{"id":536},"targetConnector":"top"}]},{"action":"gcx:wf:app::SetApplicationData","id":536,"inputs":{"key":"maxGeometries","value":{"accessors":["$formSnappingGeometryPicker"],"annotations":[{"count":27,"index":0,"kind":"idref"}],"code":"$formSnappingGeometryPicker.state.geometryPicker.size","source":"$formSnappingGeometryPicker.state.geometryPicker.size"}},"position":"-30,100","title":"Set Application Data","transitions":[{"id":647,"position":"90,130 90,170","sourceConnector":"bottom","target":{"id":646},"targetConnector":"top"}]},{"action":"gcx:wf:app::GetApplicationData","id":646,"inputs":{"key":"maxGeometries"},"name":"getApplicationDataMaxGeometries","position":"-30,170","title":"Get Application Data","transitions":[{"id":663,"position":"90,240 90,280","sourceConnector":"bottom","target":{"id":662},"targetConnector":"top"}]},{"action":"gcx:wf:core::SetProperty","id":662,"inputs":{"object":{"accessors":["$valueMaxGeometries"],"annotations":[{"count":19,"index":0,"kind":"idref"}],"code":"$valueMaxGeometries","source":"$valueMaxGeometries"},"propertyName":"result","propertyValue":{"accessors":["$getApplicationDataMaxGeometries"],"annotations":[{"count":32,"index":0,"kind":"idref"}],"code":"$getApplicationDataMaxGeometries.value","source":"$getApplicationDataMaxGeometries.value"}},"position":"-30,280","title":"Set Property","transitions":[{"id":730,"position":"90,310 90,350","sourceConnector":"bottom","target":{"id":725},"targetConnector":"top"}]},{"action":"gcx:wf:core::Annotation","description":"We set the initial Max Geometries by the workflow here so they are remembered.\\\nThe Geometry Picker attribute that sets this `size` gets updated to hide the original button and we can't depend it.","id":701,"inputs":{},"position":"220,100","title":"Notes"},{"action":"gcx:wf:core::SetProperty","id":721,"inputs":{"object":{"accessors":["$valueGeometryType"],"annotations":[{"count":18,"index":0,"kind":"idref"}],"code":"$valueGeometryType","source":"$valueGeometryType"},"propertyName":"result","propertyValue":{"accessors":["$getApplicationDataGeometryType"],"annotations":[{"count":31,"index":0,"kind":"idref"}],"code":"$getApplicationDataGeometryType.value","source":"$getApplicationDataGeometryType.value"}},"position":"-30,530","title":"Set Property"},{"action":"gcx:wf:app::GetApplicationData","id":723,"inputs":{"key":"geometryType"},"name":"getApplicationDataGeometryType","position":"-30,420","title":"Get Application Data","transitions":[{"id":727,"inputs":{},"position":"90,490 90,530","sourceConnector":"bottom","target":{"id":721},"targetConnector":"top"}]},{"action":"gcx:wf:app::SetApplicationData","id":725,"inputs":{"key":"geometryType","value":{"accessors":["$formSnappingGeometryPicker"],"annotations":[{"count":27,"index":0,"kind":"idref"}],"code":"$formSnappingGeometryPicker.state.geometryPicker.format","source":"$formSnappingGeometryPicker.state.geometryPicker.format"}},"position":"-30,350","title":"Set Application Data","transitions":[{"id":729,"inputs":{},"position":"90,380 90,420","sourceConnector":"bottom","target":{"id":723},"targetConnector":"top"}]},{"action":"gcx:wf:core::Annotation","description":"We set the geometry type by the workflow here so it's remembered.\\\nThe Geometry Picker attribute that sets this `format` gets used for its other value/geometry contents and its likely best to try and match.","id":733,"inputs":{},"position":"220,350","title":"Notes"}],"title":"load-geometryPicker"},{"id":587,"steps":[{"id":588,"inputs":{},"position":"0,0","purpose":"start","title":"Container","transitions":[{"id":677,"position":"90,60 90,100","sourceConnector":"bottom","target":{"id":594},"targetConnector":"top"}]},{"action":"gcx:wf:core::If","description":"if `maxGeometries` is less than or equal to the Geometry Picker features\\\n**`true:`** Hide this button to avoid adding more.\\\n**`false:`** Show button, more could still be added.","id":594,"inputs":{"condition":{"accessors":["$valueMaxGeometries","$formSnappingGeometryPicker"],"annotations":[{"count":19,"index":0,"kind":"idref"},{"count":27,"index":30,"kind":"idref"}],"code":"$valueMaxGeometries.result <= $formSnappingGeometryPicker.state.geometryPicker.value.geometry.length","source":"$valueMaxGeometries.result <= $formSnappingGeometryPicker.state.geometryPicker.value.geometry.length"}},"position":"-30,100","title":"If maxGeometries","transitions":[{"branch":"true","id":602,"inputs":{},"position":"-30,205 -70,205 -70,330","sourceConnector":"left","target":{"id":596},"targetConnector":"top"},{"branch":"false","id":604,"inputs":{},"position":"210,205 250,205 250,330","sourceConnector":"right","target":{"id":598},"targetConnector":"top"}]},{"action":"gcx:wf:forms::HideFormElement","id":596,"inputs":{"elementName":{"accessors":["$formSnappingGeometryPicker"],"annotations":[{"count":27,"index":0,"kind":"idref"}],"code":"$formSnappingGeometryPicker.state.buttonBarGeometryPickerAddOn","source":"$formSnappingGeometryPicker.state.buttonBarGeometryPickerAddOn"},"form":{"accessors":["$$form"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$$form","source":"$$form"}},"position":"-190,330","title":"Hide Form Element"},{"action":"gcx:wf:forms::ShowFormElement","id":598,"inputs":{"elementName":{"accessors":["$formSnappingGeometryPicker"],"annotations":[{"count":27,"index":0,"kind":"idref"}],"code":"$formSnappingGeometryPicker.state.buttonBarGeometryPickerAddOn","source":"$formSnappingGeometryPicker.state.buttonBarGeometryPickerAddOn"},"form":{"accessors":["$$form"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$$form","source":"$$form"},"visible":true},"position":"130,330","title":"Show Form Element"}]},{"id":619,"steps":[{"id":622,"inputs":{},"position":"0,0","purpose":"start","title":"Container","transitions":[{"id":650,"position":"90,60 90,100","sourceConnector":"bottom","target":{"id":629},"targetConnector":"top"}]},{"action":"gcx:wf:forms::ShowFormElement","id":625,"inputs":{"elementName":{"accessors":["$formSnappingGeometryPicker"],"annotations":[{"count":27,"index":0,"kind":"idref"}],"code":"$formSnappingGeometryPicker.state.buttonBarGeometryPickerAddOn","source":"$formSnappingGeometryPicker.state.buttonBarGeometryPickerAddOn"},"form":{"accessors":["$$form"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$$form","source":"$$form"},"visible":true},"position":"130,330","title":"Show Form Element"},{"action":"gcx:wf:core::If","description":"if `maxGeometries` is less than or equal to the Geometry Picker features\\\n**`true:`** Hide this button to avoid adding more.\\\n**`false:`** Show button, more could still be added.","id":629,"inputs":{"condition":{"accessors":["$valueMaxGeometries","$formSnappingGeometryPicker"],"annotations":[{"count":19,"index":0,"kind":"idref"},{"count":27,"index":30,"kind":"idref"}],"code":"$valueMaxGeometries.result <= $formSnappingGeometryPicker.state.geometryPicker.value.geometry.length","source":"$valueMaxGeometries.result <= $formSnappingGeometryPicker.state.geometryPicker.value.geometry.length"}},"position":"-30,100","title":"If maxGeometries","transitions":[{"branch":"true","id":635,"inputs":{},"position":"-30,205 -70,205 -70,330","sourceConnector":"left","target":{"id":631},"targetConnector":"top"},{"branch":"false","id":637,"inputs":{},"position":"210,205 250,205 250,330","sourceConnector":"right","target":{"id":625},"targetConnector":"top"}]},{"action":"gcx:wf:forms::HideFormElement","id":631,"inputs":{"elementName":{"accessors":["$formSnappingGeometryPicker"],"annotations":[{"count":27,"index":0,"kind":"idref"}],"code":"$formSnappingGeometryPicker.state.buttonBarGeometryPickerAddOn","source":"$formSnappingGeometryPicker.state.buttonBarGeometryPickerAddOn"},"form":{"accessors":["$$form"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$$form","source":"$$form"}},"position":"-190,330","title":"Hide Form Element"}]},{"id":620,"steps":[{"action":"gcx:wf:core::Container","description":"empty","id":368,"inputs":{},"name":"containerGeometryPickerLogic","position":"-30,500","title":"Container"},{"id":624,"inputs":{},"position":"0,-140","purpose":"start","title":"Event","transitions":[{"id":680,"position":"90,-80 90,-40","sourceConnector":"bottom","target":{"id":679},"targetConnector":"top"}]},{"action":"gcx:wf:core::Container","description":"Logic to ensure the Max Geometries from the geometry picker is maintained.","id":641,"inputs":{},"position":"120,300","title":"Container","transitions":[{"id":681,"position":"240,460 240,480 90,480 90,500","sourceConnector":"bottom","target":{"id":368},"targetConnector":"top"}]},{"action":"gcx:wf:core::If","description":"If `value` is `undefined` the geometry picker was emptied:\\\n**`true:`** The Geometry Picker was emptied so we show the button.\\\n**`false:`** The geometry Picker is not empty and we continue regularly.","id":679,"inputs":{"condition":{"accessors":["$formSnappingGeometryPicker"],"annotations":[{"count":27,"index":0,"kind":"idref"}],"code":"$formSnappingGeometryPicker.state.geometryPicker.value === undefined","source":"$formSnappingGeometryPicker.state.geometryPicker.value === undefined"}},"position":"-30,-40","title":"If value exists.","transitions":[{"branch":"true","id":683,"position":"-30,75 -80,75 -80,230","sourceConnector":"left","target":{"id":682},"targetConnector":"top"},{"branch":"false","id":695,"position":"210,75 240,75 240,230","sourceConnector":"right","target":{"id":694},"targetConnector":"top"}]},{"action":"gcx:wf:forms::ShowFormElement","id":682,"inputs":{"elementName":{"accessors":["$formSnappingGeometryPicker"],"annotations":[{"count":27,"index":0,"kind":"idref"}],"code":"$formSnappingGeometryPicker.state.buttonBarGeometryPickerAddOn","source":"$formSnappingGeometryPicker.state.buttonBarGeometryPickerAddOn"},"form":{"accessors":["$$form"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$$form","source":"$$form"},"visible":true},"position":"-200,230","title":"Show Form Element","transitions":[{"id":747,"position":"-80,260 -80,300","sourceConnector":"bottom","target":{"id":746},"targetConnector":"top"}]},{"action":"gcx:wf:core::SetProperty","id":694,"inputs":{"object":{"accessors":["$formSnappingGeometryPicker"],"annotations":[{"count":27,"index":0,"kind":"idref"}],"code":"$formSnappingGeometryPicker.state.geometryPicker","source":"$formSnappingGeometryPicker.state.geometryPicker"},"propertyName":"size","propertyValue":{"accessors":["$formSnappingGeometryPicker"],"annotations":[{"count":27,"index":0,"kind":"idref"}],"code":"$formSnappingGeometryPicker.state.geometryPicker.value.geometry.length","source":"$formSnappingGeometryPicker.state.geometryPicker.value.geometry.length"}},"position":"120,230","title":"Set Property","transitions":[{"id":696,"position":"240,260 240,300","sourceConnector":"bottom","target":{"id":641},"targetConnector":"top"}]},{"action":"gcx:wf:core::Annotation","description":"The major downside to an \"add on button\" is that you may need to duplicate logic that your Geometry Picker would handle for its events such as `on-change` or `validation`.\n\nYou may have to maintain this logic here and in the \"add on\" button `on-change` logic.. or trigger that element's event, but I can't find a way to do that currently.","id":704,"inputs":{},"position":"220,500","title":"Notes"},{"action":"gcx:wf:forms::HideFormElement","id":746,"inputs":{"elementName":{"accessors":["$formSnappingGeometryPicker"],"annotations":[{"count":27,"index":0,"kind":"idref"}],"code":"$formSnappingGeometryPicker.state.geometryPicker","source":"$formSnappingGeometryPicker.state.geometryPicker"},"form":{"accessors":["$$form"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$$form","source":"$$form"}},"position":"-200,300","title":"Hide Form Element","transitions":[{"id":748,"position":"-80,330 -80,480 90,480 90,500","sourceConnector":"bottom","target":{"id":368},"targetConnector":"top"}]},{"action":"gcx:wf:core::Annotation","description":"We get the geometries and set them to the size so the geometry picker is always \"full\" and the regular button never appears. Since the \"add on\" button works off of the Max Geometries saved as application data it will appear/disappear appropriately.","id":775,"inputs":{},"position":"370,230","title":"Notes"}],"title":"change-geometryPicker"}],"deploymentConfig":{"supportedApps":{"GWV":true}},"designerVersion":"5.33.1+4","forms":[{"defaults":{},"elements":{"buttonBarGeometryPickerAddOn":{"enabled":true,"index":5,"items":{"0":{"index":0,"label":{"markdown":"✛ Draw"},"value":"draw"}},"rowIndex":0,"rowNumber":2,"type":"ButtonBar"},"checkBoxSnapping":{"checked":true,"enabled":true,"index":1,"label":{"markdown":"Activate Snapping"},"rowIndex":1,"rowNumber":0,"type":"CheckBox"},"footer":{"enabled":true,"items":{"0":{"default":true,"index":0,"label":{"markdown":"Close"},"validates":true,"value":"close"}},"section":"footer","type":"ButtonBar"},"geometryPicker":{"autoActivate":false,"description":{"markdown":""},"enabled":true,"format":"polygon","index":4,"itemLabel":{"markdown":"geometry"},"prompt":{"markdown":"Draw"},"require":false,"rowIndex":0,"rowNumber":1,"size":3,"title":{"markdown":""},"type":"GeometryPicker","visible":false},"header":{"section":"header","title":{"markdown":"Snapping Geometry Picker (Component)"},"type":"Header"},"spacer1":{"description":{"markdown":""},"enabled":true,"index":2,"rowIndex":2,"rowNumber":0,"type":"Text"},"spacer2":{"description":{"markdown":""},"enabled":true,"index":3,"rowIndex":3,"rowNumber":0,"type":"Text"},"textGeometryPickerTitle":{"description":{"markdown":""},"enabled":true,"index":0,"rowIndex":0,"rowNumber":0,"title":{"markdown":"Geometry Picker Title"},"type":"Text"}},"id":934}],"start":{"id":3},"transitions":[{"branch":"content","id":58,"inputs":{},"source":{"id":56},"target":{"id":16}},{"branch":"clicked$buttonBarGeometryPickerAddOn","id":110,"source":{"id":942},"target":{"id":109}},{"branch":"changed$checkBoxSnapping","id":118,"source":{"id":942},"target":{"id":117}},{"branch":"content","id":371,"source":{"id":368},"target":{"id":370}},{"branch":"content","id":503,"inputs":{},"source":{"id":501},"target":{"id":442}},{"branch":"load$geometryPicker","id":535,"source":{"id":942},"target":{"id":534}},{"branch":"content","id":589,"source":{"id":586},"target":{"id":588}},{"branch":"content","id":643,"inputs":{},"source":{"id":641},"target":{"id":622}},{"branch":"changed$geometryPicker","id":946,"inputs":{},"source":{"id":942},"target":{"id":624}}]}

    Here is an example of it in action. Lots of low-level potential errors and not everything was fully tested, but hopefully a good start to anyone else coming across this post that needs this functionality until they improve.

    0
  • Andreas Broothaerts

    Hi @... ;

    Any update regarding this? 

    0
  • Alan Clack

    @...

    Amazing! Thanks for the support and updating this thread. I assumed this was a bug, and built all of our tools to use our work around components in a modular way so it should be easy for us to delete those and check out the fixed functionality with no down time. I'm sure they'll be glad to hear this will be an setup when we get to the updates.

    Thanks again for a clean resolution to this thread:
    https://support.vertigis.com/hc/en-us/community/posts/11497412713234/comments/18562126305682

    1
  • Gareth Evans

    Alan Clack you are welcome! I am glad to hear that you have a modular approach and that reimplementing should be relatively quick.

    For others on the thread (Andreas Broothaerts, Zofia Dudziuk Wouter Hajnal and others) if this is still something you are challenged with I would suggest updating to the latest version of VSW and re-testing.

    0

Please sign in to leave a comment.