IBoltMapService.cs 4.47 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FLY.Thick.Base.Common;
using System.Collections.ObjectModel;
using System.ComponentModel;
using Misc;

namespace FLY.Thick.Base.IService
{
    public delegate void ActiveEventHandler(object sender);
    public interface IBoltMapService : INotifyPropertyChanged
    {
        /// <summary>
        /// 第1个分区号
        /// </summary>
        int FirstBoltNo { get; set; }
        /// <summary>
        /// 分区表
        /// </summary>
        ObservableCollection<Range> Bolts { get; }

        /// <summary>
        /// 修改完上面的参数后,应用!!
        /// </summary>
        void Apply();

        #region 只用于描述 Bolts,没什么用 
        /// <summary>
        /// 最后一个分区号
        /// </summary>
        int LastBoltNo { get; }
        /// <summary>
        /// 平均分区间隔
        /// </summary>
        int BoltInterval { get; }
        /// <summary>
        /// 平均分区宽度
        /// </summary>
        int BoltWidth { get; }
        /// <summary>
        /// 脉冲范围 开始
        /// </summary>
        int PosBegin { get; }
        /// <summary>
        /// 脉冲范围 结束
        /// </summary>
        int PosEnd { get; }
        #endregion

        /// <summary>
        /// 查找边界类型
        /// </summary>
        BORDER_TYPE BorderType { get; set; }
        /// <summary>
        /// 开始边界分区号
        /// </summary>
        int BorderBoltNo_B { get; set; }
        /// <summary>
        /// 结束边界分区号
        /// </summary>
        int BorderBoltNo_E { get; set; }

        /// <summary>
        /// 平滑,以前后分区平均滤波 ,=0,只有自己,1,左右各一个
        /// </summary>
        int Smooth { get; set; }
        /// <summary>
        /// 修正完边界分区后应用。
        /// </summary>
        void ApplyBorder();

        event ActiveEventHandler ActiveEvent;
    }

    public interface IBoltMapBase
    {
        /// <summary>
        /// 第1分区号
        /// </summary>
        int FirstBoltNo { get; }
        /// <summary>
        /// 当前总分区数
        /// </summary>
        int NBolts { get; }
        /// <summary>
        /// 平滑
        /// </summary>
        int Smooth { set; get; }
        /// <summary>
        /// 边界对齐方式,只能是中间对齐
        /// </summary>
        BORDER_TYPE BorderType { get; }
        /// <summary>
        /// 获取当前使用分区表
        /// </summary>
        /// <param name="boltno1st"></param>
        /// <param name="bolts"></param>
        void GetBolts(out int boltno1st, out IEnumerable<Range> bolts);
        /// <summary>
        /// 给定分区号,获取扫描范围
        /// </summary>
        /// <param name="boltno"></param>
        /// <param name="posBegin"></param>
        /// <param name="posEnd"></param>
        void GetScanRange(Range boltno, out int posBegin, out int posEnd);
        /// <summary>
        /// 脉冲转获取分区序号
        /// </summary>
        /// <param name="pos"></param>
        /// <returns></returns>
        int GetBoltIndex_fromPos(int pos);
        #region 边界修正
115 116 117
        /// <summary>
        /// 复位位置转换器  Amp=1,Offset=0
        /// </summary>
潘栩锋's avatar
潘栩锋 committed
118 119
        void InitExChange();

120 121 122 123 124
        /// <summary>
        /// 计算位置转换器
        /// </summary>
        /// <param name="direction"></param>
        /// <param name="bolt_r"></param>
潘栩锋's avatar
潘栩锋 committed
125 126
        void CalExChange(Misc.DIRECTION direction, Range bolt_r);

127 128 129 130 131 132
        /// <summary>
        /// 真实位置 转为 分区表中的位置
        /// </summary>
        /// <param name="direction"></param>
        /// <param name="position"></param>
        /// <returns></returns>
潘栩锋's avatar
潘栩锋 committed
133 134
        int PositionExchange(Misc.DIRECTION direction, int position);

135 136 137 138 139 140
        /// <summary>
        /// 分区表位置 转为 真实位置
        /// </summary>
        /// <param name="direction"></param>
        /// <param name="bolt_pos"></param>
        /// <returns></returns>
潘栩锋's avatar
潘栩锋 committed
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
        int BoltExchange(Misc.DIRECTION direction, int bolt_pos);
        #endregion

        #region 用于动态生成分区数据

        void InitBoltAD();

        bool UpdateBoltAD(int[] data, int start_pos, int posOfGrid, Misc.DIRECTION direction, out int start_boltIndex, out int[] boltAD);

        #endregion


        int[] Map(Misc.DIRECTION direction, int posBegin, int posOfGrid, int[] dat);
    }
    
}