- addListener
- addOverlay
- addOverlayToGroup
- createOverlayGroup
- closeInfoWindow
- createNewMap
- getType
- getWorkingInfo
- setWorkingInfo
- setType
- getOverlays
- getGroups
- getWorkingOverlay
- import
- importById
- load
- loadById
- importSmJSON
- loadSmJSON
- openInfoWindow
- removeListener
- removeOverlay
- save
- saveCurrent
- startAutoSave
- stopAutoSave
- wipe
- (Events)
- addListener
- closeGallery
- createLegend
- createTool
- editMarker
- setMarkerLibrary
- showCrosshairs
- hideCrosshairs
- getCurrentTool
- getSearchControl
- hideAlert
- hideLoader
- showPanel
- hidePanel
- addDomElement
- removeLegend
- removeListener
- removeTool
- setAvailableTools
- setMenuIcons
- showMenuIcon
- hideMenuIcon
- setMapTypes
- setTheme
- setStyle
- setTool
- showAlert
- showCustomPanel
- showLoader
- showNotice
- hideNotice
- updateNotice
- runScript
- styleControl
- setSearchRegion
- setSearchBounds
- setSearchAppendString
- (Events)
Types
- clearCoords
- getBounds
- getCoords
- getCoordAt
- setCoords
- setCoordAt
- addCoordAt
- deleteCoordAt
- setStyle
- getStyle
- add
- addAt
- remove
- show
- hide
- enableEdit
- disableEdit
- isVisible
- click
- mouseover
- mouseout
- mousedown
- mouseup
- getTitle
- getDescription
- setTitle
- setDescription
- getMetaData
- setMetaData
- getDistance
- getArea
- getOverlayType
- addListener
- removeListener
- (Events)
ScribbleMap class (Example)
Global Variable: ScribbleMap or scribblemaps.ScribbleMap
The ScribbleMap Class is the core editor class. All of its functions and events are grouped by their uses. For
instance to create a marker would be ScribbleMap.draw.marker([0,0]) or to change the available tools
would be ScribbleMap.ui.setAvailableTools(["edit", "drag", "polygon"]).
Printing an instantiated Scribble Map Class to the console (particularily in chrome)
will show a readable structure.
Constructor
Constructor | Description |
---|---|
ScribbleMap(element:Node, opts?:ScribbleMapOptions) |
Creates a new map inside of the given HTML container, which is typically a DIV element. |
Properties
Member | Class | Description |
---|---|---|
map |
Map | Provides methods for interacting with map data. Including load/importing existing maps and working with map overlays. |
ui |
Ui | Provides methods for interacting with the UI. |
draw |
Draw | Provides methods for drawing and creating overlays. |
settings |
Settings | Provides methods for getting and setting settings of the editor. |
view |
View | Provides methods for changing or setting the view. |
Methods
Methods | Return Value | Description |
---|---|---|
getBaseAPIMap() |
Object |
This function returns the underlying map API object for whichever base API is being used. Keep in mind that the base API should be used for visualization only. Interactive components will not function and overlays added to the map outside of Scribble Maps will not be saved or available through data. |
addListener(coreEvent:String, callBack:Function) |
None |
Adds a listener for a core event. See SmMapEvent. |
removeListener(coreEvent:String, callBack?:Function) |
None |
Removes a listener for a core event. See CoreEvent. |
ScribbleMapOptions Class (Example)
Global Variable: ScribbleMapOptions or scribblemaps.ScribbleMapOptions
Creates a style object.
Constructor
Constructor | Description |
---|---|
ScribbleMapOptions(props:Object) |
Creates a new ScribbleMapOptions object. |
Properties
Member | Class | Description |
---|---|---|
tools |
Array<ToolType> | Sets the tools in the UI ToolBox |
defaultTool |
type:ToolType | The tool to start selected. |
mapTypeControl |
Boolean | Show MapTypeControl |
zoomControl |
Boolean | Show ZoomControl |
lineColorControl |
Boolean | Show LineColorControl |
fillColorControl |
Boolean | Show FillColorControl |
lineSettingsControl |
Boolean | Show LineSettingsControl |
searchControl |
Boolean | Show SearchControl |
startMapType |
String | Map Type to start map on |
startCenter |
latLng:LatLng | Where to center the map |
startZoom |
Int | How zoomed should the map start |
disableZoom |
Boolean | Disable Users ability to zoom |
ScribbleMapViewer Class (Example)
Extends: ScribbleMap
Global Variable: ScribbleMapeViewer or scribblemaps.ScribbleMapeViewer
This is a convenience class. It creates a ScribbleMap editor without the toolbox. Useful for creating views of just maps
or starting with a "blank" slate.
Constructor
Constructor | Description |
---|---|
ScribbleMapViewer(element:Node, opts?:ScribbleMapOptions) |
Creates a new map inside of the given HTML container, which is typically a DIV element. |
Map Class (Example)
This class is instantiated by the ScribbleMap class and holds map functions.
Methods
Methods | Return Value | Description |
---|---|---|
addListener(type:String, callBack:Function) |
None |
Adds a listener for a map event. See SmMapEvent. |
removeListener(type:String, callBack?:Function) |
None |
Removes a listener for a map event. See SmMapEvent. |
setType(typeId:String) |
None |
Changes the base map type. This can either be a core type or type created with createTileLayer(). See SmMapTypes. |
createNewMap(complete:Function) |
None |
Creates a new map. Calling this method wipes the current map and generates a new map Id. |
getOverlays() |
Array<Overlay> |
Returns an array of overlays currently on the map. Overlays at the end are on top. |
getGroups() |
Array<Group> |
Returns an array of groups. |
getWorkingOverlay() |
Overlay | null |
If an overlay is currently being drawn or edited, returns that overlay, otherwise returns null. |
importById(id:String, complete?:Function, error?:Function, skipRender?:Boolean) |
None |
Imports a saved Scribble Map to the current map. skipRender stops the data from being added to the map. The data can be accessed through the complete function. |
loadById(id:String, complete?:Function, error?:Function, skipRender?:Boolean) |
None |
Loads a saved Scribble Map. skipRender stops the data from being added to the map. The data can be accessed through the complete function. |
openInfoWindow(latLng:LatLng, HTMLContent:String||Node, style:Style, useDefaultColors:Boolean) |
Overlay |
Opens an info window on the map. |
removeOverlay(overlay:Overlay) |
None |
Removes an overlay from the map. See getOverlays |
saveCurrent(complete:Function, error:Function) |
None |
Saves the current map. This function only works if a map has already either been saved, sminstance.map.setWorkingInfo() is called (with an id specified), or a new map is created. It is used for things like auto-saving. |
addOverlay(overlay:Overlay, zIndex?:Number) |
None |
Adds an overlay to the map with an optional zIndex. |
addOverlayToGroup(overlay:Overlay, groupId:String) |
None |
Adds an overlay to the group specified by groupId. |
createOverlayGroup(name:String, open:Boolean, log:Boolean) |
groupId:String |
Creates a new group and returns its associated groupId. |
closeInfoWindow() |
None |
Closes the currently open info window. |
getType() |
String |
Gets the current map type. |
getWorkingInfo() |
Object |
Returns the info the currently loaded or recently saved map info. |
setWorkingInfo(data) |
Object |
Sets the current working info for the map such as title, description, id, projectId, and listType. |
import(opts:LoadOptions, complete:Function, error:Function, skipRender:Boolean) |
None |
Imports a map with additional options. Primarily used for importing secure maps that requires a password. |
load(opts:LoadOptions, complete:Function, error:Function, skipRender:Boolean) |
None |
Loads a map with additional options. Primarily used for importing secure maps that requires a password. |
save(opts:SaveOptions, complete:Function, error:Function, skipRender:Boolean) |
None |
Saves a map with additional options. This function will not show the loader, in order to show the loader you must use sminstance.map.saveCurrent() |
startAutoSave() |
None |
Starts auto-saving the current map. |
stopAutoSave() |
None |
Stops auto-saving the current map. |
loadSmJSON(json:SmJSON) |
None |
Loads an SmJSON object to the map. |
importSmJSON(json:SmJSON) |
None |
Imports an SmJSON object to the map. |
wipe() |
None |
Wipes the current map of all overlays. |
Events
Events | Arguments | Description |
---|---|---|
map_loaded |
{data: SmJSON} |
Fired when a map is successful loaded |
map_loaded_error |
{data: errorEvent} |
Fired when a map is failed to load |
map_password_error |
{data: errorEvent} |
Fired when a map requires a password. |
save_start |
{data: SaveOptions} |
Fired right before a map is saved. The SaveOptions can be modified at this event before the save request is sent. |
save_error |
{data: errorEvt} |
Fired when there is failure saving the map |
save_progress |
{data: 0-1} |
Fired as map is saving |
save_complete |
None |
Fired as map is finished saving. |
smjson_error |
{data: errorEvt} |
Fired when there is an error loading SmJSON |
basetype_changed |
{data: baseTypeId} |
Fired when the base type changes |
overlay_added |
{data: Overlay} |
Fired when an overlay is added to the map |
overlay_removed |
{data: Overlay} |
Fired when an overlay is removed from the map |
overlay_over |
{data: Overlay} |
Fired when a cursor is rolled over an overlay. |
overlay_out |
{data: Overlay} |
Fired when the cursor rolls out from overlay. |
overlay_click |
{data: Overlay} |
Fired when an overlay is clicked. |
overlay_up |
{data: Overlay} |
Fired when an an overlay depressed. |
overlay_down |
{data: Overlay} |
Fired when an an overlay pressed. |
overlay_move |
{data: Overlay} |
Fired while cursor is moving over the overlay. |
Ui Class (Example)
This class is instantiated by the ScribbleMap class and holds UI functions.
Methods
Methods | Return Value | Description |
---|---|---|
addListener(type:String, callBack:Function) |
None |
Adds a listener for a UI event. See UIEvent. |
removeListener(type:String, callBack?:Function) |
None |
Removes a listener for a UI event. See UIEvent. |
closeGallery() |
None |
Closes the media gallery. |
createLegend(styleArray:Array<Style>) |
None |
Creates a legend from an array of Style. |
removeLegend() |
None |
Removes any created legend from the map. |
createTool(options:ToolDefintion) |
None |
Creates a custom tool. See playground for demo. |
setTool(toolId:String) |
None |
Sets the current tool of the editor. toolId can be either custom or core toolId. |
removeTool(toolId:String) |
None |
Removes a custom tool. Core tools cannot be removed. |
editMarker(overlay:Marker) |
None |
Opens the edit tool box for a marker. |
setMarkerLibrary(markerLibrary, keepDefaults:Boolean) |
None |
Allows you to set the markers that come up in the marker panel. See (Example) |
showCrosshairs() |
None |
Shows the crosshairs. |
hideCrosshairs() |
None |
Hide the crosshairs. |
getCurrentTool() |
String |
Returns the type of tool currently selected. |
getSearchControl() |
SearchControl |
Returns the search control, used primarily for overriding basic search functionality. |
showAlert(message:String, options:Array<String>, callbacks:Array<Function>) |
None |
Opens an alert with developer defined options. The options are defined in an array and so are the callbacks.
Example: If options[0] is selected, callbacks[0] would be called.
showAlert("Are you sure?", ["yes", "no"], [function() {alert("yes")}, function() {alert("no")}); |
hideAlert() |
None |
Hides any open alert. |
showLoader(message:String, percent:Number, hasClose:Boolean, onClose:Function) |
None |
Shows a loader. Specifying null for the percent makes it indertiminate. |
hideLoader() |
None |
Hides any open loader. |
showNotice(message:String, opts:NoticeOptions) |
noticeId:String |
Shows a notice for a fixed set of time. |
hideNotice(noticeId:String) |
None |
Hides a notice specified by noticeId that is returned by showNotice() |
updateNotice(noticeId:String, message:String, opts:NoticeOptions) |
None |
Updates a notice specified by noticeId that is returned by showNotice() |
runScript(scriptId:String) |
None |
Runs a script with the designated scriptId (created in the GIS Panel). If the script has an interface it will load it in its own window. |
showCustomPanel(element:Node, hasModalBg?:Boolean) |
None |
Shows a custom panel from the developer. |
showPanel(panelType:String) |
None |
Shows a panel specified by type |
hidePanel(panelType?:String) |
None |
Hides any open panel or panel speficied by panelType. |
addDomElement(Element) |
None |
Adds a custom UI element to the Scribble Map object. Elements added in this way will come up behind loaders, modals, etc.. |
setAvailableTools(type:Array<String>) |
None |
Sets the current UI toolbox icons. Example: ["drag", "select", "polygon"]. See ToolType |
setMenuIcons(type:Array<MenuIcon>) |
None |
Sets the menu icons in the menu icon panel |
showMenuIcon(type:String) |
None |
Shows a menu icon in the menu panel. |
hideMenuIcon(type:String) |
None |
Hides a menu icon in the menu panel. |
setTheme(type:String) |
None |
Sets the theme of the editor. Valid options are "light" and "dark". |
setStyle(style:Style) |
None |
Sets the style for the UI to be used with tools. |
setMapTypes(type:Array<String>) |
None |
Sets the current map types to be display in the the map type control. ["terrain", "hybrid", "yourCustomTileLayer"] |
styleControl(type:String, style:CssStyleObject) |
None |
Sets inline styles on UI controls. |
setSearchRegion(region:String) |
None |
Set a region bias for the search control such as "us" or "es" |
setSearchBounds(bounds:Bounds) |
None |
Sets a bound bias for the search control. |
setSearchAppendString(appendStr:String) |
None |
Sets a string to silenty add to the add of every search query such as "United States of America". This works more effectively than biasing. |
Events
Events | Arguments | Description |
---|---|---|
viewloader_open |
None |
Fired when loader is opened |
viewloader_close |
None |
Fired when loader is closed |
infowindow_open |
None |
Fired when info window is opened |
infowindow_close |
None |
Fired when info window is closed |
alert_open |
None |
Fired when alert is opened |
alert_close |
None |
Fired when alert is closed |
tool_select |
None |
Fired when new tool is selected. |
Draw Class (Example)
This class is instantiated by the ScribbleMap class and holds draw functions. Whenever you draw any overlay
it uses the global settings profile which you can change with setStyle. So it is not necessary
to pass in a new style object everytime you draw. You can also set the global style profile and then pass in just your
overrides to each draw method.
Methods
Methods | Return Value | Description |
---|---|---|
setGroup(groupId:String) |
None |
Sets the group(folder) that items will be drawn to. |
setStyle(style:Style) |
None |
Sets global draw style for all successive draw operations. NOTE: This will not change the style specified by the UI. |
infoBubble(latLng:LatLng, HTMLContent:String||Node, style?:Style, useDefaultColors:Boolean) |
Overlay |
Draws and returns info bubble. |
label(latLng:LatLng, HTMLContent:String||Node, style?:Style, useDefaultColors:Boolean) |
Overlay |
Draws and returns a label. |
line(latLngArray:Array<LatLng>, style?:Style) |
Overlay |
Draws and returns a line. |
marker(latLng:LatLng;, HTMLContent:String||Node, style?:Style) |
Marker |
Draws and returns a marker. |
mediaMarker(latLng:LatLng;, options:MediaMarkerOptions) |
Marker |
Draws and returns a media marker. |
circle(latLng:LatLng, unitRadius:String, style?:Style) |
Polygon |
Draws and returns a circle. Unit radius is physical size such as "5km". |
point(latLng:LatLng;, pixelRadius:Number, style?:Style) |
Overlay |
Draws and returns a point. |
poly(latLngArray:Array<LatLng>, style?:Style) |
Polygon |
Draws and returns a polygon. |
rect(latLngArray:Array<LatLng>, style?:Style) |
Polygon |
Draws and returns a rectangle based on maxmium dimension of provided LatLng points. |
image(latLngArray:Array<LatLng>, style?:Style) |
Overlay |
Draws and returns a image based on maxmium dimension of provided LatLng points. It should be noted that an image overlay will scale to a max size of 2500x2500. |
Data Class (Example)
This class is instantiated by the ScribbleMap class and holds data functions.
Methods
Methods | Return Value | Description |
---|---|---|
getSmJSON() |
SmJSON |
Returns a SMJSON object for the current map. |
getGeoJSON() |
Object |
Returns a GeoJSON object for the current map. |
Utils Class (Example)
This class is instantiated by the ScribbleMap class and holds utility functions.
Methods
Methods | Return Value | Description |
---|---|---|
convertUnit(value:Number, unitTypeA:String, unitTypeB:String) |
SmJSON |
Converts the provided value from unitTypeA to unitTypeB. See MeasureType |
geocode(address:String, callback:Function) |
Object |
Geocode the provided address, this has limitations based on the API utilized. |
reverseGeocode(latlng:LatLng, callback:Function) |
Object |
Reverse geocodes a latlng point. |
View Class (Example)
This class is instantiated by the ScribbleMap class and holds view functions.
Methods
Methods | Return Value | Description |
---|---|---|
addListener(type:String, callBack:Function) |
None |
Adds a listener for a View event. See ViewEvent. |
removeListener(type:String, callBack?:Function) |
None |
Removes a listener for a view event. See ViewEvent. |
fitContent() |
None |
Fits all content in view. |
getBounds() |
Bounds |
Returns bounds for the current view. |
setBounds(bounds:Bounds) |
None |
Fits the view to the provide bounds. |
getCenter() |
LatLng |
Returns the current center of the view. |
setCenter(center:LatLng) |
None |
Set the center of the view. |
getZoom() |
Number |
Returns the zoom of the view. |
setZoom(value:Number) |
None |
Set the zoom of the view. |
latLngToPixel(latLng:LatLng) |
SmPoint |
Converts latLng to pixel relative to the top left corner of the ScribbleMap. |
pixelToLatLng(point:SmPoint) |
LatLng |
Converts latLng to pixel relative to the top left corner of the ScribbleMap. |
lockView() |
None |
Locks the current view so it cannot be left via dragging. |
lockToBounds(bounds:Bounds) |
None |
Locks the current view to inputed bounds. |
unlockView() |
None |
Unlocks the view. |
render() |
None |
Renders the entire view. This methods causes a complete invalidation and can be performance intensive. Rendering is handled automatically. This should only be used in special case scenarios such as animation. |
Events
Events | Arguments | Description |
---|---|---|
zoom_start |
{data: newZoom} |
Fired when zoom starts. |
zoom_end |
{data: zoom} |
Fired when zoom is changed. |
view_changed |
None |
Fired when the view changes, either zoom or move. |
view_moved |
{data: center} |
Fired when view is moved. |
tiles_loaded |
None |
Fired when current in view tiles are loaded. Does not work on all APIs. |
view_rendered |
None |
Fired when views has rendered. |
Group Class
The Group class is returned by Map.getGroups() and is used to discover groupId.
Parameters
Name | Type | Description |
---|---|---|
id |
String |
id associated with the group. |
name |
String |
name associated with the group. |
Overlay Class (Example)
This Overlay is class is returned by ScribbleMap.map.getOverlays() and it
is also returned by ScribbleMap.draw operations. The overlay class's functions
are chainable (similar to jquery).
If for some reason you need to create an overlay without it being added to the map you can do the following.
var sm = new ScribbleMap("ScribbleMap"); var noRenderOverlay = sm.draw.marker([lat,lng]).remove();
Methods
Methods | Return Value | Description |
---|---|---|
getBounds() |
Bounds |
Returns the max bounds of the overlay. |
clearCoords() |
Overlay (self) |
Removes all coordinates of the overlay. |
getCoords() |
Array<LatLng> |
Gets LatLng coordinate array of overlay. |
getCoordAt(index:Number) |
LatLng |
Gets LatLng coordinate at provided index. |
setCoords(latLngAry:Array<LatLng>) |
Overlay (self) |
Gets LatLng coordinate at provided index. |
setCoordAt(latLng:LatLng, index:Number) |
Overlay (self) |
Sets LatLng coordinate at provided index. |
addCoordAt(latLng:LatLng, index:Number) |
Overlay (self) |
Adds a LatLng coordinate at provided index. |
deleteCoordAt(index:Number) |
Overlay (self) |
Deletes LatLng coordinate at provided index. |
setStyle(style:Style) |
Overlay (self) |
Changes the style of the overlay. |
getStyle() |
Style |
Returns the style of the overlay. |
add() |
Overlay (self) |
Adds the overlay to the map. |
addAt(index:Number) |
Overlay (self) |
Adds the overlay to the map at specified index. |
remove() |
Overlay (self) |
Removes the overlay from the map. |
hide() |
Overlay (self) |
Hides the overlay. |
show() |
Overlay (self) |
Shows the overlay. |
enableEdit() |
Overlay (self) |
Allows the overlay to be edited, by default all overlays are editable. |
disableEdit() |
Overlay (self) |
Stops an overlay from being edited with tools. |
isVisible() |
Boolean |
Return if overlay is currently visible. |
click(handler:Function) |
Overlay (self) |
Adds a click handler to the overlay. |
mouseover(handler:Function) |
Overlay (self) |
Adds a mouseover handler to the overlay. |
mouseover(handler:Function) |
Overlay (self) |
Adds a mouseout handler to the overlay. |
mousedown(handler:Function) |
Overlay (self) |
Adds a mousedown handler to the overlay. |
mouseup(handler:Function) |
Overlay (self) |
Adds a mouseup handler to the overlay. |
getTitle() |
String |
returns the title associated with the overlay. |
setTitle(title:String) |
Overlay (self) |
Sets the title for the overlay. |
getDescription() |
String |
returns the description associated with the overlay. |
setDescription(description:String) |
Overlay (self) |
Sets the description for the overlay. |
getMetaData() |
Object |
Returns the meta data object set for the object. |
setMetaData(data:Object) |
Overlay (self) |
Sets the meta data object for the object. This object is stored in the saved map. |
getDistance(unit:MeasureType) |
Number |
Returns length of an overlay. Default is in unit KM. |
getArea(unit:MeasureType) |
Number |
Returns the area of an overlay. Default is in SQKM. |
getOverlayType() |
OverlayType |
Returns the type of the overlay. |
addListener(type:String, callBack:Function) |
None |
Adds a listener for an overlay event. |
removeListener(type:String, callBack?:Function) |
None |
Removes a listener for an overlay event. |
Events
Events | Arguments | Description |
---|---|---|
click |
MouseEvent |
Fired when overlay is clicked. |
mousedown |
MouseEvent |
Fired when overlay is pressed. |
mouseup |
MouseEvent |
Fired when overlay is depressed. |
mouseover |
MouseEvent |
Fired when overlay is rolled over. |
mouseout |
MouseEvent |
Fired when overlay is rolled out. |
Polygon Class (Example)
Extends: Overlay
This Polygon class is returned by map.getOverlays() and it
is also returned by map.draw operations for polygon overlay types.
It adds a couple additional functions specific to polygon overlay types.
Methods
Methods | Return Value | Description |
---|---|---|
containsPixel(pixel:Object) |
Boolean |
Determines if a viewport pixel is currently within it. |
containsCoord(latLng:LatLng) |
Boolean |
Determines if a LatLng is currently within it. |
containsOverlay(overlay:Overlay) |
Boolean |
Determines if the polygon contains another overlay. |
collidesWith(overlay:Overlay) |
Boolean |
Determines if the polygon collides with another overlay. |
removeFill(style?:Style) |
Line |
Removes the fill from a polygon and convert it to a line. Takes an optional style parameter for new line. |
Line Class (Example)
Extends: Overlay
This Line class is returned by map.getOverlays() and it
is also returned by map.draw operations for polygon overlay types.
It adds functions specific to line overlay types.
Marker Class (Example)
Extends: Overlay
This Marker class is returned by map.getOverlays() and it
is also returned by map.draw operations for polygon overlay types.
It adds a couple additional functions specific to marker overlay types.
Methods
Methods | Return Value | Description |
---|---|---|
enableInfoWindow() |
None |
Allows an info window to be opened for the marker. |
disableInfoWindow() |
None |
Disallows an info window be opened for the marker. |
Layers Class (Example)
This class is instantiated by the ScribbleMap class and holds Layer functions.
Methods
Methods | Return Value | Description |
---|---|---|
createTileLayer(id:String, urlStack:Array, maxZoom:Number, label:String, copyright:String) |
None |
Creates a tile layer. |
setBase(id:String) |
None |
Sets the base map to a create layer with the given id. |
add(id:String) |
None |
Adds a created layer with provided id to the map. |
addAt(id:String,index:Number) |
None |
Adds a created layer with provided id to the map at given index. |
add(id:String) |
None |
Removes a created layer with provided id from the map. |
removeAt(index:Number) |
None |
Removes a layer at the provided index. |
clear() |
None |
Clears all created custom layers. |
Clustering Class (Example)
This class is instantiated by the ScribbleMap class and holds clustering (markers) functions.
Methods
Methods | Return Value | Description |
---|---|---|
enable(type?:String) |
None |
Enables marker clustering. Type can be set to "Pie" or "Normal". Pie clustering requires markers to have meta data of "group" and "groupColor". |
disable() |
None |
Disable marker clustering |
setType(type:String) |
None |
Type can be set to "Pie" or "Normal". Pie clustering requires markers to have meta data of "group" and "groupColor". |
setSizes(sizes:Array<Number> ) |
None |
Sets the sizes for css styling. Does not apply to pie clustering. |
setRangePixels(range:<Number>) |
None |
Sets how close a marker needs to be to another marker before it is clustered. |
clusterViewOverride(handler:Function) |
None |
This function allows you to create a custom view for markers when a cluster is clicked on. An array of overlays is passed to the handler function when a user clicks on a cluster. |
Settings Class (Example)
This class is instantiated by the ScribbleMap class and holds settings functions.
Methods
Methods | Return Value | Description |
---|---|---|
clearListeners() |
None |
Removes all listeners from the current app. |
disableChangesHalt() |
None |
When a user makes changes to a map, they will be halted when trying to leave the site. This function disables that functionality. To enable see enableChangesHalt() |
disableDevCatch() |
None |
Normally all input from the developer passes through a try/catch. This method disables that functionality. |
enableChangesHalt() |
None |
When a user makes changes to a map, they will be halted when trying to leave the site. This function enable that functionality. To disable see disableChangesHalt() |
enableZoom() |
None |
Enables the user to zoom the map. This enables both the zoom control and mouse wheel zoom. |
disableZoom() |
None |
Disables the user from zooming the map. This disables both the zoom control and mouse wheel zoom. |
resize() |
None |
Forces a resize of the ScribbleMap. This usually does not need to be called and dynamic resizing should be handled automatically. |
setFrameRate(fps:Number) |
None |
Sets the target frame rate for things like drawing and dragging. Default is 45 but lower frame rates are better for mobile devices. |
setToImperial() |
None |
Sets all measurements to imperial. |
setToMetric() |
None |
Sets all measurements to metric. |
setMeasurementUnits(length:MeasureType,area:MeasureType) |
None |
sets the default measurement units, used for on screen tools. |
getMeasurementUnits() |
Object |
Returns an object with an area and length parameter representing the currently set measurement units. |
toggleFullScreen() |
None |
Toggles full screen mode on and off. |
scribblemaps.LatLng Class (Example)
You generally do not need to use this class directly. Any where you can pass a LatLng
can be substituted for either an array [0,0] or an object {lat: 0, lng: 0}. This class is
useful for doing measurements.
Constructor
Constructor | Description |
---|---|
LatLng(lat:Number, lng:Number) |
Creates a new LatLng with provided arguments. |
Properties
Member | Class | Description |
---|---|---|
lat |
Number | Latitude value. |
lng |
Number | Longitude value. |
Methods
Methods | Return Value | Description |
---|---|---|
distanceFrom(latLng:LatLng, direct?:Boolean) |
Numbers |
Returns the distance in kilometers from another given LatLng. Direct calculates the Rhumb line distance. |
lat() |
Number |
Returns the latitude. |
lng() |
Number |
Returns the longitude. |
latRadians() |
Number |
Returns the latitude in radians. |
lngRadians() |
Number |
Returns the longitude in radians. |
clone() |
LatLng |
Returns a copy of the current LatLng |
scribblemaps.Bounds Class (Example)
Rectangular coordinate bounds.
Constructor
Constructor | Description |
---|---|
Bounds(lat1?:LatLng,lat2?:LatLng) |
Creates a new bounds which are extended by lat1 and lat2 if provided. |
Methods
Methods | Return Value | Description |
---|---|---|
extend(latLng:LatLng) |
Boolean |
Extends bounds by provided LatLng. |
containsBounds(bounds:Bounds) |
Boolean |
Checks if bounds contains provided bounds. |
containsCoord(latLng:LatLng) |
Boolean |
Checks if bounds contains provided LatLng. |
getCenter() |
LatLng |
Returns center LatLng. |
getNorthWest() |
LatLng |
Returns north west LatLng. |
getNorthEast() |
LatLng |
Returns north east LatLng. |
getSouthWest() |
LatLng |
Returns south west LatLng. |
getSouthEast() |
LatLng |
Returns south east LatLng. |
getNorth() |
Number |
Returns north latitude. |
getSouth() |
Number |
Returns south latitude. |
getEast() |
Number |
Returns east longitude. |
getWest() |
Number |
Returns west longitude. |
scribblemaps.Point Class (Example)
Creates a point object.
Constructor
Constructor | Description |
---|---|
Point(x:Number, y:Number) |
Creates a new point object. |
Properties
Member | Class | Description |
---|---|---|
x |
Number | x value of point. |
y |
Number | y value of point. |
scribblemaps.Style Class (Example)
Creates a style object.
Constructor
Constructor | Description |
---|---|
Style(style:Object) |
Creates a new style object. |
Properties
Member | Class | Description |
---|---|---|
lineColor |
String | Sets the color for lines. |
lineOpacity |
Number | Sets the opacity of lines and borders. Value is 0-1 |
fillColor |
String | Sets the fill color. |
fillOpacity |
Number | Sets the opacity of fills. Value is 0-1 |
weight |
Number | Sets the weight (thickness) of lines. |
lineCap |
Number | Sets the cap type for lines. See LineCap |
lineJoin |
Number | Sets the join type for lines. See LineJoin |
lineSegment |
Array | Sets the style for lines arrows. For dashes the array is [size,gap,size,gap]. For arrows the array is [width,height,gap,width,height,gap] |
rotation |
Number | Sets the rotation of markers. Value is in Radians. |
imgSrc |
String | Sets the URL to the marker to be used. |
scale |
Number | The scale of marker. Value is 0-1 |
anchor |
Point | The anchor of marker. Value is 0-1. 0.5 is center. {x: 0.5, y: 0.5} |
markerSize |
Point | The size of a marker. {x: 64, y: 64} |
tailLength |
Number | Tail length to be used for info bubbles. |
tailWidth |
Number | Tail Width to be used for info bubbles. |
tailOffset |
Number | Tail Offset to be used for info bubbles. Value is 0-1, 0.5 is center. |
tailAngle |
Number | Tail Angle to be used for info bubbles. Value is in radians. |
cornerRadius |
Number | Corner radius to be used for info bubbles. |
contentPadding |
Number | Content padding to be used for info bubbles. |
scribblemaps.MenuIcon Class (Example)
Creates a MenuIcon object.
Constructor
Constructor | Description |
---|---|
MenuIcon(data:Object) |
Creates a new menu icon object. |
Properties
Member | Class | Description |
---|---|---|
type |
String | The type of menu icon, used for css style and hiding/showing. |
label |
String | The label to show under the menu icon. |
handler |
Function | the function to call when icon is pressed. |
scribblemaps.ToolDefinition Class (Example)
Creates a ToolDefinition object. Used for creating tools with ScribbleMap.ui.createTool
Constructor
Constructor | Description |
---|---|
ToolDefinition(def:Object) |
Creates a new tool definiton object. |
Properties
Member | Class | Description |
---|---|---|
baseTool |
ToolType | Sets the base tool to use |
id |
String | Sets the id for the tool |
select |
Function | Function to call when tool is selected |
deselect |
Function | Function to call when tool is deselected |
mousedown |
Function | Function to call when map is pressed |
mouseup |
Function | Function to call when map is depressed |
mousemove |
Function | Function to call when mouse is moved around screen |
scribblemaps.NoticeOptions Class
Creates a NoticeOptions object.
Constructor
Constructor | Description |
---|---|
NoticeOptions(options:Object) |
Creates a new noticeOptions object. |
Properties
Member | Class | Description |
---|---|---|
type |
String | The type of notice. Can be one of the following types: "success", "fail", "loading", "None" |
time |
Number | How long to show the notice for in ms. If no time is specified, notice will not be hidden. |
scribblemaps.SaveOptions Class (Example)
Creates a Saveptions Object
Constructor
Constructor | Description |
---|---|
SaveOptions(opts) |
Creates a new saving options object. |
Properties
Member | Class | Description |
---|---|---|
id |
String | Id to save map as. |
password |
String | Password to either save map with or use if map is created already. |
title |
String | Title of Map |
description |
String | Description of Map |
listed |
Boolean | Whether map should be listed in our directory. |
secure |
Boolean | Whether map should be secured. Requires password to view. |
projectId |
String | ProjectId to save map to |
groupCode |
String | Group to save to in project. |
scribblemaps.LoadOptions Class (Example)
Creates a LoadOptions Object
Constructor
Constructor | Description |
---|---|
LoadOptions(opts) |
Creates a new loading options object. |
Properties
Member | Class | Description |
---|---|---|
id |
String | Id of map to load. |
password |
String | Password to load map with. Required if map is secure. |
ignoreViewSet |
Boolean | If set to true the view (center & zoom) from the loaded map will not be used. |
scribblemaps.ControlType Class
An enumerator class for Controls.
Read Only Properties
Member | Value | Description |
---|---|---|
SEARCH |
0 | Specifies the search control. |
ZOOM |
1 | Specifies the zoom control. |
TOOLBOX |
2 | Specifies the toolbox control. |
LINE_SETTINGS |
3 | Specifies the line settings control. |
LINE_COLOR |
4 | Specifies the line color control. |
FILL_COLOR |
5 | Specifies the fill color control. |
MAP_TYPE |
6 | Specifies the map type control. |
LEGEND |
7 | Specifies the map legend. |
scribblemaps.ToolType Class
An enumerator class for tool types.
Read Only Properties
Member | Value | Description |
---|---|---|
NONE |
none | Specifies no tool. |
MENU |
menu | Specifies the menu tool. |
DRAG |
drag | Specifies the drag tool. |
DRAGEDIT |
dragEdit | Specifies the drag and edit tool. |
DRAGEDITADVANCED |
dragEditAdvanced | Specifies the drag and edit tool. Advanced includes line resizing, group move and segment measurements. |
DRAW |
scribble | Specifies the scribble tool. |
DRAWSNAP |
scribbleSnap | Specifies the scribble tool with road snapping option. |
LINE |
line | Specifies the line tool. |
LINESNAP |
lineSnap | Specifies the line tool with road snapping option. |
PEN |
pen | Specifies the pen tool for drawing curves. |
FLIGHT_LINE |
flightLine | Specifies the flightLine tool. |
CONNECTED_LINE |
connectedLine | Specifies the connectedLine tool. |
EDIT |
edit | Specifies the edit tool. |
EDITADVANCED |
editAdvanced | Specifies the edit tool. Advanced includes line resizing, group move and segment measurements. |
LABEL |
label | Specifies the label tool. |
POLYGON |
polygon | Specifies the polygon tool. |
MARKER |
marker | Specifies the marker tool. |
SINGLE_MARKER |
singleMarker | Specifies the singleMarker tool. |
ERASER |
eraser | Specifies the eraser tool. |
CIRCLE |
circle | Specifies the circle tool. |
RECTANGLE |
rectangle | Specifies the rectangle tool. |
FILL |
fill | Specifies the fill tool. |
SELECT |
select | Specifies the select tool. |
ROTATE |
rotate | Specifies the rotate tool. |
SPLIT_LINE |
splitLine | Specifies the split line tool. |
STYLE_PICKER |
stylePicker | Specifies the style picker tool. |
scribblemaps.OverlayType Class
An enumerator class for overlay types.
Read Only Properties
Member | Value | Description |
---|---|---|
LINE |
1 | Specifies the line overlay type. |
RECT |
2 | Specifies the rectangle overlay type. |
CIRCLE |
3 | Specifies the circle overlay type. |
POLYGON |
4 | Specifies the polygon overlay type. |
LABEL |
5 | Specifies the label overlay type. |
MARKER |
6 | Specifies the marker overlay type. |
IMAGE |
7 | Specifies the image overlay type. |
FLIGHT_LINE |
16 | Specifies the flight line overlay type. |
INFO_BUBBLE |
17 | Specifies the info buble overlay type. |
MEDIA_MARKER |
18 | Specifies the media marker overlay type. |
POINT |
19 | Specifies the point overlay type. |
scribblemaps.PanelType Class
An enumerator class for panel types.
Read Only Properties
Member | Value | Description |
---|---|---|
MARKER |
1 | Specifies the marker panel type. |
TEXT_EDITOR |
2 | Specifies the text editor panel type. |
SETTINGS |
3 | Specifies the settings panel type. |
LOAD_MAP |
4 | Specifies the load map panel type. |
SAVE_MAP |
5 | Specifies the save map panel type. |
WIDGET |
6 | Specifies the widget panel type. |
MAP_INFO |
7 | Specifies the map info panel type. |
MENU |
8 | Specifies the menu panel type. |
SAVE_IMAGE |
9 | Specifies the save image panel type. |
SEND_TO_FRIEND |
10 | Specifies the send to friend type. |
LEGEND_CREATOR |
11 | Specifies the legend creator type. |
DIRECTIONS_CREATOR |
12 | Specifies the directions creator type. |
MANAGE_USERS |
13 | Specifies the manage users type. |
scribblemaps.MenuType Class
Specifies default Menu Icon Types
Read Only Properties
Member | Value | Description |
---|---|---|
NEW_MAP |
newMap | Specifies new map icon type/function |
LOAD_MAP |
loadMap | Specifies load map icon type/function |
SAVE_MAP |
saveMap | Specifies save map icon type/function |
WIDGET |
getWidget | Specifies get widget icon type/function |
SEND_TO_FRIEND |
sendToFriend | Specifies send to friend icon type/function |
SAVE_IMAGE |
saveImage | Specifies save image icon type/function |
FACEBOOK |
Specifies facebook share icon type/function | |
TWITTER |
Specifies twitter share icon type/function | |
KML_DOWNLOAD |
saveKML | Specifies save kml icon type/function |
GPX_DOWNLOAD |
saveGPX | Specifies save gpx icon type/function |
SHP_DOWNLOAD |
saveSHP | Specifies save shp icon type/function |
CSV_DOWNLOAD |
saveCSV | Specifies save csv icon type/function |
JSON_DOWNLOAD |
saveCSV | Specifies save json icon type/function |
MANAGE_USERS |
manageUsers | Specifies manage users icon type/function |
scribblemaps.MeasureType Class
An enumerator class for measurement types.
Read Only Properties
Member | Value | Description |
---|---|---|
MILLIMETRE |
mm | Specifies mm. |
CENTIMETRE |
cm | Specifies cm. |
METRE |
m | Specifies m. |
KILOMETRE |
km | Specifies km. |
INCH |
mm | Specifies mm. |
FOOT |
ft | Specifies ft. |
YARD |
yd | Specifies yd. |
MILE |
mi | Specifies mi. |
NAUTICAL_MILE |
nmi | Specifies nmi. |
SQUARE_CENTIMETRE |
sqcm | Specifies sqcm. |
SQUARE_METRE |
sqm | Specifies sqm. |
SQUARE_KILOMETRE |
sqkm | Specifies sqkm. |
HECTARE |
ha | Specifies ha. |
SQUARE_INCH |
sqin | Specifies sqin. |
SQUARE_FOOT |
sqft | Specifies sqft. |
SQUARE_YARD |
sqyd | Specifies sqyd. |
SQUARE_MILE |
sqmi | Specifies sqmi. |
ACRE |
acre | Specifies acre. |
scribblemaps.ViewEvent Class
An enumerator class for view events.
Read Only Properties
Member | Value | Description |
---|---|---|
ZOOM_START |
zoom_start | Specifies the zoom_start event. |
ZOOM_END |
zoom_end | Specifies the zoom_end event. |
CHANGED |
view_changed | Specifies the view_changed event. |
TILES_LOADED |
tiles_loaded | Specifies the tiles_loaded event. |
MOVED |
view_moved | Specifies the view_moved event. |
RENDERED |
view_rendered | Specifies the view_rendered event. |
scribblemaps.MapEvent Class
An enumerator class for map events.
Read Only Properties
Member | Value | Description |
---|---|---|
MAP_SAVE_ERROR |
save_error | Specifies the save_error event. |
MAP_SAVE_START |
save_start | Specifies the save_start event. |
MAP_SAVED |
save_complete | Specifies the save_complete event. |
MAP_LOADED |
map_loaded | Specifies the map_loaded event. |
MAP_LOAD_ERROR |
map_load_error | Specifies the map_load_error event. |
MAP_PASSWORD_ERROR |
map_password_error | Specifies the map_password_error event. |
NEW_MAP |
new_map | Specifies the new_map event. |
SMJSON_ERROR |
smjson_error | Specifies the smjson_error event. |
BASE_TYPE_CHANGED |
basetype_changed | Specifies the basetype_changed event. |
OVERLAY_ADDED |
overlay_added | Specifies the overlay_added event. |
OVERLAY_CHANGED |
overlay_changed | Specifies the overlay_changed event. |
OVERLAY_META_CHANGED |
overlay_meta_changed | Specifies the overlay_meta_changed event. |
OVERLAY_REMOVED |
overlay_removed | Specifies the overlay_removed event. |
OVERLAY_OVER |
overlay_over | Specifies the overlay_over event. |
OVERLAY_OUT |
overlay_out | Specifies the overlay_out event. |
OVERLAY_CLICK |
overlay_click | Specifies the overlay_click event. |
OVERLAY_UP |
overlay_up | Specifies the overlay_up event. |
OVERLAY_DOWN |
overlay_down | Specifies the overlay_down event. |
OVERLAY_MOVE |
overlay_move | Specifies the overlay_move event. |
scribblemaps.DrawEvent Class
An enumerator class for draw events.
Read Only Properties
Member | Value | Description |
---|---|---|
STYLE_CHANGED |
style_changed | Specifies the style_changed event. |
scribblemaps.UIEvent Class
An enumerator class for UI events.
Read Only Properties
Member | Value | Description |
---|---|---|
VIEWLOADER_OPEN |
viewloader_open | Specifies the viewloader_open event. |
VIEWLOADER_CLOSE |
viewloader_close | Specifies the viewloader_close event. |
INFOWINDOW_OPEN |
infowindow_open | Specifies the infowindow_open event. |
INFOWINDOW_CLOSE |
infowindow_close | Specifies the infowindow_close event. |
PANEL_OPEN |
panel_open | Specifies the panel_open event. |
PANEL_CLOSE |
panel_close | Specifies the panel_close event. |
ALERT_CLOSE |
alert_close | Specifies the alert_close event. |
ALERT_OPEN |
alert_open | Specifies the alert_open event. |
PANEL_MARKER_SELECT |
panel_marker_select | Fired when a marker is selected on the marker panel. |
SEARCH_ITEM_SELECT |
search_item_select | Fired when an item is selected from the search control. |
TOOL_SELECT |
tool_select | Fired when a new tool is selected. |
scribblemaps.CoreEvent Class
An enumerator class for core events.
Read Only Properties
Member | Value | Description |
---|---|---|
ALL_READY |
ready | Specifies the ready event. Fired when both Scribble Maps and the underlying partner API is ready. |
scribblemaps.CapType Class
An enumerator class for cap types.
Read Only Properties
Member | Value | Description |
---|---|---|
ROUND |
0 | Specifies and round cap type for lines and boundaries. |
SQUARE |
1 | Specifies and square cap type for lines and boundaries. |
scribblemaps.JoinType Class
An enumerator class for line join types.
Read Only Properties
Member | Value | Description |
---|---|---|
ROUND |
0 | Specifies round line joining for lines and boundaries. |
MITER |
1 | Specifies miter line joining for lines and boundaries. |
scribblemaps.LineType Class
An enumerator class for line types.
Read Only Properties
Member | Value | Description |
---|---|---|
SOLID |
0 | Specifies a solid line type. |
DASHED |
1 | Specifies a dashed line type. |
ARROW |
2 | Specifies an arrow line type. |
ARROW_ONLY |
3 | Specifies an arrow only line type. |