Sunday 20 May 2018

javascript - Resizing and Reshaping features in Openlayers


Resizing and Reshaping features in Openlayers. I have a map with Openlayers and some controls to draw and modify Features.


I need to activate the Resize and Drag and Rotate check button fields as defaults when i push the modify button. Currently i have to push the check fields for this.


When i push the modify button it lets me modify all points in my circle without the resize,rotate and drag check buttons checked,


I dont want to be able to modify points just resize, drag and rotate.


Please run the code below to get a better understanding:



                              























  • onclick="toggleControl(this);" checked="checked" />








  • onclick="toggleControl(this);" />



    • name="rotate" onChange="update()" />




    • name="resize" onChange="update()" />

      name="keepAspectRatio" onChange="update()" checked="checked" />




    • name="drag" onChange="update()" />







Answer



This must be a typo on your code, but change activate: function update() { to function update() {.


now add checked="checked" to the checkboxes you want on by default, in the demo case i'll have them all checked. (thought rotating a circle is pointless, I left it in.)





change the "modify feature" radio option to call update() intead of toggleControl(this):




And activate the modify control:


controls["modify"].activate();


Here's the demo. You can View Source on it.



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...