Class: InkModel
InkModel.InkModel(typeopt, rootIDopt)
Provides hierarchical representation of ink data model
Constructor
new InkModel(typeopt, rootIDopt)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type | InkModel.InkTree.Type | <optional> | STROKE | Ink model type |
rootID | string.<GUID> | <optional> | auto generated GUID | Root node ID |
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
id | string | <optional> | External identifier | |
version | string | <optional> | UIM version, available only when model is decoded | |
disableSensorDataIntegrity | boolean | <optional> | true | When stroke is removed from the model, stroke sensor data will be kept by default,to keep integrity between strokes and sensor data, this flag should be false |
unitScaleFactor | float | <optional> | 1 | Conversion factor for strokes points - DIP conversions, when 1, conversion is not needed |
transform | Common.Matrix | Ink model transform matrix, could be set on demand | ||
sensorData | Array.<InkInput.SensorData> | Ink model sensor input, use setter to register not stroke related sensor data (like hover data for example) | ||
strokes | Array.<Stroke> | |||
props | object.<string, any> | <optional> | User defined model properties | |
knowledgeGraph | Semantics.TripleStore | Ink model knowledge |
Extends
Methods
addPath(path, parentopt, indexopt) → InkModel.InkPath
Shorthand of createElement + appendChild
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
path | Stroke|InkInput.SensorData | |||
parent | InkModel.InkGroup | <optional> | root | Where to add path |
index | int | <optional> | children.length | Node position |
Returns:
InkPath node
Type
clone() → InkModel
Provides copy of the current instance
Returns:
Ink model copy
Type
createElement(content, viewopt, fragmentopt) → InkModel.InkPath
Creates path nodes for underlying model
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
content | Stroke|InkInput.SensorData | ||
view | InkModel.View | <optional> | Model underlying view |
fragment | PathBuilding.SplineFragment | <optional> | applicable only in views |
Returns:
InkPath node
Type
createGroup(idopt) → InkModel.InkGroup
Creates group nodes for underlying model
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
id | string.<GUID> | <optional> | auto generated GUID | InkGroup ID |
Returns:
InkGroup node
Type
createView(name, rootIDopt) → InkModel.View
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
name | URI | View descriptor | ||
rootID | string.<GUID> | <optional> | auto generated GUID | Root node name |
Returns:
Underlying view
Type
getBrush(name) → Rendering.Brush
Get brush related with model
Parameters:
Name | Type | Description |
---|---|---|
name | URI | Brush identifier |
Returns:
Type
getNode(id) → InkModel.InkNode
Get ink DOM element
Parameters:
Name | Type | Description |
---|---|---|
id | string | InkNode identifier (it could be internal id or it's uri) |
Returns:
Type
getPath(id) → Stroke|InkInput.SensorData
Get path registerd in the model structure.InkPath could be a Stroke or SensorData data, depends from the model type.
Parameters:
Name | Type | Description |
---|---|---|
id | string | InkPath identifier |
Returns:
Type
getSensorData(id) → InkInput.SensorData
Get sensor data
Parameters:
Name | Type | Description |
---|---|---|
id | string | SensorData identifier |
Returns:
Type
getStroke(id) → Stroke
Get stroke registerd in the model structure.This method is applicable only for models with type STROKE.
Parameters:
Name | Type | Description |
---|---|---|
id | string | Stroke identifier |
Returns:
Type
removePath(path)
Shorthand of element lookup + remove
Parameters:
Name | Type | Description |
---|---|---|
path | Stroke|InkInput.SensorData |
removeView(name)
Parameters:
Name | Type | Description |
---|---|---|
name | URI | View descriptor |
replacePath(stroke, strokes, autoGroupopt)
Replace stroke node with few ones
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
stroke | Stroke | Source stroke | ||
strokes | Array.<Stroke> | Source stroke fragmented data | ||
autoGroup | boolean | <optional> | false | Make group node for replacement |