Class: TrackParser

Kekule.Editor. TrackParser

new TrackParser()

A class to parse the touch/mouse track and generate corresponding chem structure.
Source:

Extends

  • ObjectEx

Methods

addLineCrossPoints(linePoints) → {Array}

Add cross points of line segments. Those points should be regarded as node in structure.
Parameters:
Name Type Description
linePoints Array
Source:
Returns:
New line points with cross points.
Type
Array

addVertexToLineMergePoint(linePoints, distanceThreshold) → {Array}

If a point is very close to line (distance less than threshold), this point should be considered on the line.
Parameters:
Name Type Description
linePoints Array
distanceThreshold Float
Source:
Returns:
Type
Array

convertLinesToGraph(linePoints) → {Kekule.Graph}

Convert line point sequence to a graph.
Parameters:
Name Type Description
linePoints Array
Source:
Returns:
Type
Kekule.Graph

convertTrackToStructure(editor, trackCoords, defIsotopeId, structFragment) → {Kekule.StructureFragment}

Convert track coord sequence to a chem structure fragment.
Parameters:
Name Type Description
editor Kekule.Editor.BaseEditor The target editor widget.
trackCoords Array Screen coords of track.
defIsotopeId String
structFragment Kekule.StructureFragment Optional. If not set, a new structure fragment will be created and returned.
Source:
Returns:
Type
Kekule.StructureFragment

mergeCloseVertexes(graph, distanceThreshold)

Merge some near vertexes in graph.
Parameters:
Name Type Description
graph Kekule.Graph
distanceThreshold Float
Source:

mergeNearbyTrackPoints(graph, distanceThreshold)

Merge some near points in line segments.
Parameters:
Name Type Description
graph Kekule.Graph
distanceThreshold Float
Source:

refineTrack(trackCoords) → {Hash}

Simplify and standardize a track
Parameters:
Name Type Description
trackCoords Hash
Source:
Returns:
Type
Hash

removeRepetitivePoints(trackCoords) → {Array}

Remove continuous coord sequence caused by nearby point merging.
Parameters:
Name Type Description
trackCoords Array
Source:
Returns:
Type
Array