public override void DoSecondPass(Dictionary <string, LDLBOBase> parsedObjects) { LDLBOBase trackObject; parsedObjects.TryGetValue(Track1Str, out trackObject); Track_1 = trackObject as LDLTrack; }
protected static void CreateGraphicLine(string[] definition, LDLTrack result, int graphicLineStartIndex, int nLines) { int graphicLineEndIdx = -1; for (int idx = graphicLineStartIndex; idx < nLines; idx++) { if (definition[idx].Contains(LDLSeperators.TERMINATER)) { graphicLineEndIdx = idx; break; } } if (graphicLineEndIdx > 0)//we have a properly defined line { definition[graphicLineStartIndex] = definition[graphicLineStartIndex].Replace(POINT_COLLECTION_START, ""); definition[graphicLineStartIndex] = definition[graphicLineStartIndex].Replace(graphic_line, ""); definition[graphicLineStartIndex] = definition[graphicLineStartIndex].Replace(LDLSeperators.LINE_SEPERATOR, ""); definition[graphicLineEndIdx] = definition[graphicLineEndIdx].Replace(POINT_COLLECTION_END, ""); definition[graphicLineEndIdx] = definition[graphicLineEndIdx].Replace(LDLSeperators.TERMINATER, ""); result.Graphic_Line = new LDLGraphicLine(); for (int idx = graphicLineStartIndex; idx <= graphicLineEndIdx; idx++) { string pointToProcess = definition[idx].Remove(definition[idx].Length - 1);//on the last line this will be removing a space, otherwise, remove the comma pointToProcess = pointToProcess.Trim(); result.Graphic_Line.Points.Add(new LDLPoint(pointToProcess)); } } }
public override void DoSecondPass(Dictionary <string, LDLBOBase> parsedObjects) { LDLBOBase trackObject; parsedObjects.TryGetValue(TrackAsStr, out trackObject); Track = trackObject as LDLTrack; this.ID = Track.ID + "_" + Start.ToString() + "_" + End.ToString();//I want this to have an ID and be saved as a node in the ontology }
public override void DoSecondPass(Dictionary <string, LDLBOBase> parsedObjects) { LDLBOBase trackObject; parsedObjects.TryGetValue(TrackStr, out trackObject); Track = trackObject as LDLTrack; this.ID = Track.ID + this.Distance.ToString(); }
public LDLBOBase CreateItem(string[] definition, string id) { LDLTrack result = new LDLTrack(id); int graphicLineStartIndex = -1; int index = 0; int nLines = definition.GetLength(0); foreach (string line in definition)//Don't be clever with continues in this loop - it messes up index { if (line.Contains(node_0)) { result.Node0AsStr = ParseItem(line); } else if (line.Contains(node_1)) { result.Node1AsStr = ParseItem(line); } else if (line.Contains(graphic_line)) { graphicLineStartIndex = index; } else if (line.Contains(LENGTH)) { result.Length = decimal.Parse(ParseItem(line)); } index++; if ((!string.IsNullOrEmpty(result.Node1AsStr)) && (!string.IsNullOrEmpty(result.Node0AsStr)) && (result.Length > 0) && (graphicLineStartIndex > 0)) { break; //When all the fields that are done in this loop are done, break } } if (graphicLineStartIndex > 0) { CreateGraphicLine(definition, result, graphicLineStartIndex, nLines); } return(result); }