Hi Everybody!
Here in Western Oregon we have a weird and specific tool requirement called the "Template test." Its is mandated by statute (ORS 215.750) and has been causing me significant grief trying to build it.
The workflow as follows is simple:
1. The user selects a taxlot or group of taxlots.
2. The centroid of the selected Shape(s) is calculated, and added as a point
3. The user chooses either a box (0.5 mile x 0.5 mile square, or a .25 mile x 1 mile rectangle) to be created with the calculated point as the center.
4. The user may then move the box and point to adjust the center and rotate the orientation of the box for various reasons.
5. After the user is satisfied with the placement and orientation of the box, a calculation is run to determine the number of dwellings present in the area in a static dataset (1993 Taxlots) and the number of dwellings present in the modern taxlots dataset.
6. The user can print a report of the findings or reset the process and start again.
Steps 3 and 4 are the parts providing a problem. I can't for the life of me come up with a way to draw the boxes of pre-determined size around the center-point, and then allow them to be moved and rotated afterwards. It seems so simple, but I've just hit a mental block.
Any Ideas would be greatly appreciated. This tool is the last barrier to replacing our old WPF based runtime application.
Thanks!
Solved! Go to Solution.
Eric,
3 and 4 would have to be something like you allow the user to draw the point using the DrawBox dijit and then take that point and create your polygon using the point.x minus 1/2 of the width of the polygon and point.y minus 1/2 the height to get the upper left corner coordinates and then add the height to the upper left y, etc etc to get the 4 corners and then use polygon constructor to create your polygon from this array of points. https://developers.arcgis.com/javascript/3/jsapi/polygon-amd.html#polygon3
Once you add the polygon to the maps graphic or a GraphicsLayer you added to the map then you use the editor dijit
Editor | API Reference | ArcGIS API for JavaScript 3.20
to allow you to move and rotate it.
You can look at the code in the eDraw widget to get code for how to allow editing drawn graphics.
Eric,
3 and 4 would have to be something like you allow the user to draw the point using the DrawBox dijit and then take that point and create your polygon using the point.x minus 1/2 of the width of the polygon and point.y minus 1/2 the height to get the upper left corner coordinates and then add the height to the upper left y, etc etc to get the 4 corners and then use polygon constructor to create your polygon from this array of points. https://developers.arcgis.com/javascript/3/jsapi/polygon-amd.html#polygon3
Once you add the polygon to the maps graphic or a GraphicsLayer you added to the map then you use the editor dijit
Editor | API Reference | ArcGIS API for JavaScript 3.20
to allow you to move and rotate it.
You can look at the code in the eDraw widget to get code for how to allow editing drawn graphics.
Thanks Robert! This is a great start!