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 linePointsArray 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 linePointsArray distanceThresholdFloat Returns:
- Type
- Array
-
convertLinesToGraph(linePoints) → {Kekule.Graph}
-
Convert line point sequence to a graph.
Parameters:
Name Type Description linePointsArray Returns:
- Type
- Kekule.Graph
-
convertTrackToStructure(editor, trackCoords, defIsotopeId, structFragment) → {Kekule.StructureFragment}
-
Convert track coord sequence to a chem structure fragment.
Parameters:
Name Type Description editorKekule.Editor.BaseEditor The target editor widget. trackCoordsArray Screen coords of track. defIsotopeIdString structFragmentKekule.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 graphKekule.Graph distanceThresholdFloat -
mergeNearbyTrackPoints(graph, distanceThreshold)
-
Merge some near points in line segments.
Parameters:
Name Type Description graphKekule.Graph distanceThresholdFloat -
refineTrack(trackCoords) → {Hash}
-
Simplify and standardize a track
Parameters:
Name Type Description trackCoordsHash Returns:
- Type
- Hash
-
removeRepetitivePoints(trackCoords) → {Array}
-
Remove continuous coord sequence caused by nearby point merging.
Parameters:
Name Type Description trackCoordsArray Returns:
- Type
- Array