-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an annotation registry. #616
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ var $ = require('jquery'); | |
var inherit = require('./inherit'); | ||
var geo_event = require('./event'); | ||
var transform = require('./transform'); | ||
var registerAnnotation = require('./registry').registerAnnotation; | ||
|
||
var annotationId = 0; | ||
|
||
|
@@ -16,7 +17,8 @@ var annotationState = { | |
* Base annotation class | ||
* | ||
* @class geo.annotation | ||
* @param {string} type the type of annotation. | ||
* @param {string} type the type of annotation. These should be registered | ||
* with utils.registerAnnotation and can be listed with same function. | ||
* @param {object?} options Inidividual annotations have additional options. | ||
* @param {string} [options.name] A name for the annotation. This defaults to | ||
* the type with a unique ID suffixed to it. | ||
|
@@ -309,6 +311,8 @@ var rectangleAnnotation = function (args) { | |
}; | ||
inherit(rectangleAnnotation, annotation); | ||
|
||
registerAnnotation('rectangle', rectangleAnnotation, {polygon: true}); | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
/** | ||
* Polygon annotation class | ||
|
@@ -504,6 +508,9 @@ var polygonAnnotation = function (args) { | |
}; | ||
inherit(polygonAnnotation, annotation); | ||
|
||
registerAnnotation('polygon', polygonAnnotation, { | ||
polygon: true, 'line.basic': [annotationState.create]}); | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
/** | ||
* Point annotation class | ||
|
@@ -598,6 +605,8 @@ var pointAnnotation = function (args) { | |
}; | ||
inherit(pointAnnotation, annotation); | ||
|
||
registerAnnotation('point', pointAnnotation, {point: true}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My only suggestion would is that features (keys) are not visible anywhere else. Should we create a list of it somewhere at the top may be? then you can say annotation.point: true There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure having another list aids much here. There is no strict reason why an annotation should need to use the same feature that any other annotation used (I don't know what a heatmap annotation would look like, but we could have one). I think if we wanted to make this more based on definitions, then we should probably add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just pushed a change which does this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @manthey Just as a side note, heatmap annotations look like the old-school MS Paint spray can tool. I've seen papers where this is used to allow users to generate distributions over vernacular geographic entities (e.g. downtown). There might actually be some useful applications of an annotation type like this (especially in medical imaging?) |
||
|
||
module.exports = { | ||
state: annotationState, | ||
annotation: annotation, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1