new TrackParser()
A class to parse the touch/mouse track and generate corresponding chem structure.
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 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 Returns:
- Type
- Array
-
convertLinesToGraph(linePoints) → {Kekule.Graph}
-
Convert line point sequence to a graph.
Parameters:
Name Type Description linePoints
Array 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. Returns:
- Type
- Kekule.StructureFragment
-
mergeCloseVertexes(graph, distanceThreshold)
-
Merge some near vertexes in graph.
Parameters:
Name Type Description graph
Kekule.Graph distanceThreshold
Float -
mergeNearbyTrackPoints(graph, distanceThreshold)
-
Merge some near points in line segments.
Parameters:
Name Type Description graph
Kekule.Graph distanceThreshold
Float -
refineTrack(trackCoords) → {Hash}
-
Simplify and standardize a track
Parameters:
Name Type Description trackCoords
Hash Returns:
- Type
- Hash
-
removeRepetitivePoints(trackCoords) → {Array}
-
Remove continuous coord sequence caused by nearby point merging.
Parameters:
Name Type Description trackCoords
Array Returns:
- Type
- Array