private static void MoveSegmentSymmetrically(GenericPosture posture, GenericPostureImpactHorizontalSymmetry impact) { // Moves a segment so it is symmetric to another segment relatively to a vertical symmetry axis. GenericPostureSegment impacting = posture.Segments[impact.Impacting]; GenericPostureSegment impacted = posture.Segments[impact.Impacted]; GenericPostureSegment axis = posture.Segments[impact.Axis]; Vector vStart = new Vector(posture.PointList[impacting.Start], posture.PointList[axis.Start]); posture.PointList[impacted.Start] = new PointF(posture.PointList[axis.Start].X + vStart.X, posture.PointList[impacting.Start].Y); Vector vEnd = new Vector(posture.PointList[impacting.End], posture.PointList[axis.End]); posture.PointList[impacted.End] = new PointF(posture.PointList[axis.End].X + vEnd.X, posture.PointList[impacting.End].Y); }
private void ParseImpacts(XmlReader r) { r.ReadStartElement(); while (r.NodeType == XmlNodeType.Element) { if (r.Name == "Align") { GenericPostureImpactLineAlign impact = new GenericPostureImpactLineAlign(r); if (impact != null) { Impacts.Add(impact); } } else if (r.Name == "VerticalAlign") { GenericPostureImpactVerticalAlign impact = new GenericPostureImpactVerticalAlign(r); if (impact != null) { Impacts.Add(impact); } } else if (r.Name == "HorizontalAlign") { GenericPostureImpactHorizontalAlign impact = new GenericPostureImpactHorizontalAlign(r); if (impact != null) { Impacts.Add(impact); } } else if (r.Name == "Pivot") { GenericPostureImpactPivot impact = new GenericPostureImpactPivot(r); if (impact != null) { Impacts.Add(impact); } } else if (r.Name == "KeepAngle") { GenericPostureImpactKeepAngle impact = new GenericPostureImpactKeepAngle(r); if (impact != null) { Impacts.Add(impact); } } else if (r.Name == "HorizontalSymmetry") { GenericPostureImpactHorizontalSymmetry impact = new GenericPostureImpactHorizontalSymmetry(r); if (impact != null) { Impacts.Add(impact); } } else if (r.Name == "SegmentCenter") { GenericPostureImpactSegmentCenter impact = new GenericPostureImpactSegmentCenter(r); if (impact != null) { Impacts.Add(impact); } } else if (r.Name == "PerdpendicularAlign") { GenericPosturePerpendicularAlign impact = new GenericPosturePerpendicularAlign(r); if (impact != null) { Impacts.Add(impact); } } else if (r.Name == "ParallelAlign") { GenericPostureParallelAlign impact = new GenericPostureParallelAlign(r); if (impact != null) { Impacts.Add(impact); } } else { string outerXml = r.ReadOuterXml(); log.DebugFormat("Unparsed content in XML: {0}", outerXml); } } r.ReadEndElement(); }