Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Contributor
Posts: 63
Registered: ‎02-22-2016

Dynamic FormMaps

We are in requirement of a workflow that has dynamic FormMaps, where the user shall be able to display on and off the features in FormMap just by checking / clicking list of features provided to him inside the workflow.

 

Has anyone done such kind of implementation so far? If so, can I know how to make it work?

Highlighted
Super Contributor
Posts: 455
Registered: ‎10-12-2015

Re: Dynamic FormMaps

Following is a snippet from our system that does some simple layer control and zoom in / out for FormMap.

We put the layers to display in a non-persisted field and then change that field when layers are turned on/off. Following code also has some fit operations additional to what you wanted you will have to remove. Someone else wrote the javascript bit, but if I recall correctly changing the fitFactor field the workflow system refreshes the FormMap {FORM.FitFactor} causing a refresh of the FormMap.

 

.
.
.
    <FormField name="FitFactor" persisted="false" visible="hidden" defaultvalue="SQL[IF( {SESSION.PermitSettings.FitFactor} !=0) select {SESSION.PermitSettings.FitFactor} else DECLARE @factor bigint SET @factor = (select ((select AREA from PARCELS where ID=(select Parcel_ID from dbo.AUTH_Permit where ID={FORM.Permit_ID}))/869484)*1000000000) IF(@factor &lt; 100000000) select 100000000 ELSE IF (@factor &gt; 10000000000) select 10000000000 ELSE select @factor]" saveinsession="true" datatype="number"/>
    <FormField name="Layers" persisted="false" visible="hidden" defaultvalue="SQL[if(({FORM.PZones}=1) and ({FORM.GCZones}=1)) select '2883,2882,877,1072,2110,2881' else if ({FORM.PZones}=1) select '2882,877,1072,2110,2881' else if ({FORM.GCZones}=1) select '2883,877,1072,2110,2881' else select '877,1072,2110,2881']"/>
    <FormMap name="PermitLocation" label="Permit Location" visible="true" layers="{FORM.Layers}" drawingmode="highlighted" heightratio="1" fitfactor="{FORM.FitFactor}" fitelements="{FORM.Permit_ID}" template="MapBigTemplate" activelayer="2881"/>
    <FormAction name="ZoomOut" action="SCRIPT[IG.form.getItemById('FitFactor').setValue({FORM.FitFactor}*2)]"></FormAction>
    <FormAction name="ZoomIn" action="SCRIPT[IG.form.getItemById('FitFactor').setValue({FORM.FitFactor}/2)]"></FormAction>
   </FormGroup>
   <FormGroup name="Map_Details" label="Extra Layers in Form Map" template="GroupNoLabelTemplate">
    <FormSingleRow name="ExtraLayers" template="FormSingleRow3FieldsTemplate">
     <FormField name="PZones" persisted="false" type="checkbox" defaultvalue="0"/>
     <FormField name="GCZones" persisted="false" type="checkbox" defaultvalue="0"/>
    </FormSingleRow>
    <FormAction name="ApplyLayers" action="SCRIPT[IG.form.getItemById('FitFactor').setValue({FORM.FitFactor}*1.00001)]"></FormAction>
   </FormGroup>
.
.
.

Highlighted
Contributor
Posts: 63
Registered: ‎02-22-2016

Re: Dynamic FormMaps

So far useful.