Beispiel #1
0
        private static void AlignPointVertical(GenericPosture posture, CalibrationHelper calibrationHelper, int handle, GenericPostureImpactVerticalAlign impact)
        {
            if (impact == null)
            {
                return;
            }

            /*PointF impacted = calibrationHelper.GetPoint(posture.Points[impact.PointRef]);
             * PointF impacting = calibrationHelper.GetPoint(posture.Points[posture.Handles[handle].Reference]);
             *
             * PointF result = calibrationHelper.GetImagePoint(new PointF(impacted.X, impacting.Y));
             * posture.Points[impact.PointRef] = result;*/

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

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