/// <summary>
 /// 更新量測結果.
 /// 量測演算法放這裡
 /// </summary>
 public override void UpdateResults()
 {
     try
     {
         _Result = DistanceHelper.AngleLineToLine(_geoModelOne, _geoModelTwo);
         if (_Result != null)
         {
             if (mMeasAssist.mIsCalibValid && mMeasAssist.mTransWorldCoord)
             {
                 Rectify(_Result.Row, _Result.Col, out _ResultWorld.Row, out _ResultWorld.Col);
             }
             else
             {
                 _ResultWorld = new AngleResult(_Result);
             }
         }
     }
     catch (HOperatorException ex)
     {
         mMeasAssist.exceptionText = ex.Message;
         _ResultWorld = new AngleResult();
         _Result      = new AngleResult();
     }
     UpdateXLD();
 }
Example #2
0
        /// <summary>
        /// 計算線與線的角度
        /// </summary>
        /// <param name="line1">IMeasureGeoModel 線段1</param>
        /// <param name="line2">IMeasureGeoModel 線段2</param>
        /// <returns></returns>
        public static AngleResult AngleLineToLine(IMeasureGeoModel line1, IMeasureGeoModel line2)
        {
            AngleResult result = null;

            //check
            if (isMeasureModelValid(line1) && isMeasureModelValid(line2))
            {
                //act
                HTuple angle, firstPhi, secondPhi, interRow, interCol, isParallel;
                HOperatorSet.AngleLx(line1.Row1, line1.Col1, line1.Row2, line1.Col2, out firstPhi);

                HOperatorSet.AngleLx(line2.Row1, line2.Col1, line2.Row2, line2.Col2, out secondPhi);

                HOperatorSet.IntersectionLl(line1.Row1, line1.Col1, line1.Row2, line1.Col2, line2.Row1, line2.Col1, line2.Row2, line2.Col2,
                                            out interRow, out interCol, out isParallel);
                HOperatorSet.AngleLl(line1.Row1, line1.Col1, line1.Row2, line1.Col2, line2.Row1, line2.Col1, line2.Row2, line2.Col2, out angle);
                result = new AngleResult()
                {
                    Angle    = angle,
                    StartPhi = firstPhi,
                    EndPhi   = secondPhi,
                    Row      = interRow,
                    Col      = interCol,
                };
            }
            return(result);
        }
 private void initialize(IMeasureGeoModel geoModelOne, IMeasureGeoModel geoModelTwo, MeasureAssistant mAssist)
 {
     _geoModelOne   = geoModelOne;
     _geoModelTwo   = geoModelTwo;
     ROIMeasureType = MeasureType.Angle;
     //_Result = new AngleResult();
     _ResultWorld = new AngleResult();
     UpdateResults();
 }
 public override void ClearResultData()
 {
     _ResultWorld = new AngleResult();
 }
        /// <summary>
        /// 更新量測結果.
        /// 量測演算法放這裡
        /// </summary>
        public override void UpdateResults()
        {
            try
            {
                _Result = DistanceHelper.AngleLineToLine(_geoModelOne, _geoModelTwo);
                if (_Result != null)
                {
                    if (mMeasAssist.mIsCalibValid && mMeasAssist.mTransWorldCoord)
                    {
                        Rectify(_Result.Row, _Result.Col, out _ResultWorld.Row, out _ResultWorld.Col);
                    }
                    else
                    {
                        _ResultWorld = new AngleResult(_Result);
                    }
                }

            }
            catch (HOperatorException ex)
            {
                mMeasAssist.exceptionText = ex.Message;
                _ResultWorld = new AngleResult();
                _Result = new AngleResult();
            }
            UpdateXLD();
        }
 public override void ClearResultData()
 {
     _ResultWorld = new AngleResult();
 }
 private void initialize(IMeasureGeoModel geoModelOne, IMeasureGeoModel geoModelTwo, MeasureAssistant mAssist)
 {
     _geoModelOne = geoModelOne;
     _geoModelTwo = geoModelTwo;
     ROIMeasureType = MeasureType.Angle;
     //_Result = new AngleResult();
     _ResultWorld = new AngleResult();
     UpdateResults();
 }
        /// <summary>
        /// 計算線與線的角度
        /// </summary>
        /// <param name="line1">IMeasureGeoModel 線段1</param>
        /// <param name="line2">IMeasureGeoModel 線段2</param>
        /// <returns></returns>
        public static AngleResult AngleLineToLine(IMeasureGeoModel line1, IMeasureGeoModel line2)
        {
            AngleResult result = null;
            //check
            if (isMeasureModelValid(line1) && isMeasureModelValid(line2))
            {
                //act
                HTuple angle, firstPhi, secondPhi, interRow, interCol, isParallel;
                HOperatorSet.AngleLx(line1.Row1, line1.Col1, line1.Row2, line1.Col2, out firstPhi);

                HOperatorSet.AngleLx(line2.Row1, line2.Col1, line2.Row2, line2.Col2, out secondPhi);

                HOperatorSet.IntersectionLl(line1.Row1, line1.Col1, line1.Row2, line1.Col2, line2.Row1, line2.Col1, line2.Row2, line2.Col2,
                    out interRow, out interCol, out isParallel);
                HOperatorSet.AngleLl(line1.Row1, line1.Col1, line1.Row2, line1.Col2, line2.Row1, line2.Col1, line2.Row2, line2.Col2, out angle);
                result = new AngleResult()
                {
                    Angle = angle,
                    StartPhi = firstPhi,
                    EndPhi = secondPhi,
                    Row = interRow,
                    Col = interCol,
                };
            }
            return result;
        }
 public AngleResult(AngleResult result)
     : this(result.Angle, result.StartPhi, result.EndPhi)
 {
 }
 public AngleResult(AngleResult result)
     : this(result.Angle, result.StartPhi, result.EndPhi)
 {
 }