new Caption(viewer, options, meta)
Create a new Caption.
| Name | Type | Description | 
|---|---|---|
viewer | 
            
            
            Viewer | 
                
                    
                    
                        
                    
                
                 The viewer.  | 
        
options | 
            
            
            Object | 
                
                    
                    
                        
                    
                
                 Attributes used to create the caption.  | 
        
meta | 
            
            
            Object | 
                
                    
                        optional
                    
                    
                        
                    
                
                 User-defined Meta data to add to the caption.  | 
        
Extends
Members
- 
    
anchorString
 - 
    
    
Get or set the caption anchor position.
 - 
    
backgroundColorColor
 - 
    
    
Get or set the backgroundColor. When setting the color, a string representing the color or a
Colorobject can be used. For details seeColor. - 
    
canvasCanvas
 - 
    
    
Get the canvas.
 - 
    
fontFont
 - 
    
    
Get or set the font. When setting the font, a string representing the font or a
Fontobject can be used. For details seeFont. - 
    
fontColorColor
 - 
    
    
Get or set the fontColor. When setting the color, a string representing the color or a
Colorobject can be used. For details seeColor. - 
    
layoutLayout
 - 
    
    
Get the layout.
 - 
    
metaBoolean
 - 
    
    
Get or Set the meta data of this object. See the meta data tutorial for details.
 - 
    
nameString
 - 
    
    
Get or set the text shown for this caption.
 - 
    
onString
 - 
    
    
Get or set where the caption will be relative to. Values: 'map', 'canvas'
 - 
    
onCanvasBoolean
 - 
    
    
Returns true if the caption is positioned on the canvas
 - 
    
onMapBoolean
 - 
    
    
Returns true if the caption is positioned on the map
 - 
    
positionString
 - 
    
    
Get or set the caption position.
 - 
    
sequenceSequence
 - 
    
    
Get the sequence.
 - 
    
textAlignmentString
 - 
    
    
Get or set the text alignment. Possible values are left, center, or right.
 - 
    
viewerViewer
 - 
    
    
Get or set the Viewer
 - 
    
visibleBoolean
 - 
    
    
Get or Set the visibility of this object.
 
Methods
- 
    
inherited addPluginOptions(id, options)
 - 
    
    
    
Add a plugin to the object.
Name Type Description idString The id of the plugin
optionsObject The plugin options
 - 
    
clear()
 - 
    
    
    
Clear the box containing this caption.
 - 
    
inherited deleteFromObjects()
 - 
    
    
    
Remove the object from Viewer.objects
 - 
    
draw()
 - 
    
    
    
Draw the caption
 - 
    
inherited hasPlugin(pluginID){Boolean}
 - 
    
    
    
Does this object have a particular plugin?
Name Type Description pluginIDString The ID of the plugin
Returns:
Type Description Boolean - Whether the object has the plugin
 
 - 
    
highlight(color)
 - 
    
    
    
Highlight the caption by drawing a box around it.
Name Type Description colorColor Color of the highlighting outline
 - 
    
invertColors()
 - 
    
    
    
Invert the colors of the caption (i.e. backgroundColor and fontColor).
 - 
    
move(newIndex)
 - 
    
    
    
Move this caption to a new index in the array of Viewer captions.
Name Type Description newIndexNumber New index for this caption (0-based)
 - 
    
moveTo(duration)
 - 
    
    
    
Move the map to center the caption. Only works with caption positioned on the map (not the canvas).
Name Type Default Description durationNumber 1000 Duration of move animation
 - 
    
inherited optionsForPlugin(pluginName){Object}
 - 
    
    
    
Get the options for a particular plugin.
Name Type Description pluginNameString The name of the plugin
Returns:
Type Description Object - The options for the plugin or undefined if the plugin is not found
 
 - 
    
remove()
 - 
    
    
    
Remove caption
 - 
    
toJSON()
 - 
    
    
    
Returns JSON representing the object
 - 
    
toString(){String}
 - 
    
    
    
Return the class name as a string.
Returns:
Type Description String - 'Caption'
 
 - 
    
update(attributes)
 - 
    
    
    
Update caption attributes. See updating records for details.
Name Type Description attributesObject Object describing the properties to change
 - 
    
inherited updatePluginOptions(id, options)
 - 
    
    
    
Update plugin options. Merge the new options with the old options.
Name Type Description idString The id of the plugin
optionsObject The plugin options