예제 #1
0
        private static void AlignPointHorizontal(GenericPosture posture, int handle, GenericPostureImpactHorizontalAlign impact)
        {
            if (impact == null)
            {
                return;
            }

            PointF impacted  = posture.PointList[impact.PointRef];
            PointF impacting = posture.PointList[posture.Handles[handle].Reference];

            posture.PointList[impact.PointRef] = new PointF(impacting.X, impacted.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();
        }