Feature #77

Add an interface for drawing a custom polygon mapped to data coordinates and saved in the session state

Added by Andy Dufilie almost 6 years ago. Updated over 5 years ago.

Status:ResolvedStart date:11/02/2011
Priority:NormalDue date:
Assignee:Kyle Monico% Done:

100%

Category:Visualization Interface
Target version:1.0
Complexity:Medium OIC Priority:
Required by:Grand Rapids, Michigan

Description

Similar to using the annotation pen tool, but the polygon should be mapped to data coordinates and it should only be drawn on a visualization (not the desktop).

Also, a function should be created that queries all layers on the same visualization for keys that intersect the polygon that has been drawn. This function can then be called from JavaScript once feature #82 is implemented.


Subtasks

Feature #620: Add fill color and alpha options to session state of custom polygonResolvedKyle Monico


Related issues

Related to Weave - Feature #97: Add a Pen tool for graphical annotation Resolved 06/30/2011
Related to Weave - Feature #394: Pen tool should have a mode for drawing straight lines instead of freehand Resolved 08/17/2011
Related to Weave - Feature #82: Provide a way to call any function of any object from the JavaScript interface Resolved 06/30/2011
Precedes Weave - Feature #41: Allow drawing a radius (in the session state) Resolved 11/03/2011

History

#1 Updated by Andy Dufilie almost 6 years ago

  • Subject changed from Allow drawing a custom polygon (saved in the session state) to Allow drawing a custom polygon mapped to data coordinates (saved in the session state)

#2 Updated by Andy Dufilie almost 6 years ago

  • Description updated (diff)

#3 Updated by Andy Dufilie almost 6 years ago

  • Complexity set to Medium

#4 Updated by admin account almost 6 years ago

  • Complexity changed from Medium to 2-Medium

#5 Updated by admin account almost 6 years ago

  • Complexity changed from 2-Medium to ** Medium **

#6 Updated by admin account almost 6 years ago

  • Complexity changed from ** Medium ** to Medium

#7 Updated by Andy Dufilie almost 6 years ago

  • Required by set to Grand Rapids, Michigan

#8 Updated by Andy Dufilie almost 6 years ago

  • Subject changed from Allow drawing a custom polygon mapped to data coordinates (saved in the session state) to Add an interface for drawing a custom polygon mapped to data coordinates and saved in the session state
  • Description updated (diff)
  • Priority changed from Normal to Urgent

#9 Updated by Andy Dufilie almost 6 years ago

  • Estimated time set to 75.00

#10 Updated by Kyle Monico over 5 years ago

  • Status changed from Open to In Progress
  • Assignee set to Kyle Monico

#11 Updated by Chris Stefanich over 5 years ago

  • Due date set to 12/01/2011

#12 Updated by Kyle Monico over 5 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

This should be in the nightly build tonight.

To enable the PenTool for a visualization, right click the visualization and click "Enable PenTool." This will enable it in the default mode of free drawing (same behavior as before).

You can right click and select "Change Drawing Mode" which will clear your old drawings and change to the polygon drawing mode. Click once to start drawing and all subsequent clicks will draw a line from the last vertex to the new vertex. A double click will set the last point and reconnect back to the first point for the polygon.

After drawing, you can do the following:
weave.evaluateExpression(['MapTool', 'children', 'penTool'], 'selectRecords()')
Which will go through the polygons and select keys overlapping the drawing. The drawings are all tied to data coordinates now.

#13 Updated by Chris Stefanich over 5 years ago

Sounds Great!

Is there a way to enable the pen tool and change drawing mode through the session state?

#14 Updated by Kyle Monico over 5 years ago

When you create an instance of the object, penTool.drawingMode.value = PenTool.POLYGON_DRAW_MODE should do the trick for setting the mode to polygon drawing. You could enable it in the XML because drawingMode is a sessioned property.

Something like this should work from JS:

weave.evaluateExpression(['MapTool', 'children', 'penTool'], 'drawingMode.value = POLYGON_DRAW_MODE', null, ['weave.ui::PenTool'])

I can't test it right now.

There isn't a sessioned property for enabling it, but you could set the editMode property of the penTool to boolean true. The expression to evaluate would become 'editMode = true'

Let me know if you run into any issues.

#15 Updated by Kyle Monico over 5 years ago

We found a few bugs with this that will be fixed by Monday. Sorry about that.

#16 Updated by Chris Stefanich over 5 years ago

Is there any way to specify the fill color of the polygon? Through the session state would be fine, we do not need a GUI to do that, if it is even possible. We would like the polygon to have a fill color and also the ability to adjust the alpha.

#17 Updated by Andy Dufilie over 5 years ago

Please create new issues for additional features. I've created one for you: #620

#18 Updated by Chris Stefanich over 5 years ago

Another thing, to enable the pen tool as suggested:

document.getElementById('weave').evaluateExpression(['MapTool', 'children', 'penTool'],
'editMode.value = true',
null, ['weave.ui::PenTool']);
gives the error:
ReferenceError: Error #1056

I noticed the session state "penTool" did not have a node calledx "editMode", I tried adding one with the value "false" and it is still the same error.

#19 Updated by Kyle Monico over 5 years ago

editMode is just a getter/setter boolean which isn't sessioned. It doesn't have a "value" property.

// to enable editing
weave.evaluateExpression(['MapTool', 'children', 'penTool'], 'editMode = true', null, ['weave.ui::PenTool'])

// to set the mode (this is sessioned, which is why it's drawingMode.value)
weave.evaluateExpression(['MapTool', 'children', 'penTool'], 'drawingMode.value = POLYGON_DRAW_MODE', null, ['weave.ui::PenTool'])

Note that the MapTool needs a penTool in its children, which you can request via Javascript using

weave.requestObject(['MapTool', 'children', 'penTool'], 'weave.ui::PenTool')

If the penTool object is already there, which would have happened if someone did editing previously, the function does nothing.

#20 Updated by Andy Dufilie over 5 years ago

  • Target version set to 1.0

Also available in: Atom PDF