コード例 #1
0
 private void Awake()
 {
     reloader         = GetComponent <IReloadService>();
     clip             = GetComponent <IClip>();
     userCommunicator = GetComponent <IUserCommunicator>();
     //clip.onAmmoChange.AddListener((x) => OnAmmoChange());
 }
コード例 #2
0
ファイル: XTrackEx.cs プロジェクト: ylmbtm/seqence
 public static bool AddClip(this XTrack track, IClip clip, ClipData data)
 {
     if (track.clips == null)
     {
         track.clips      = new IClip[1];
         track.clips[0]   = clip;
         track.data.clips = new[] { data };
         return(true);
     }
     else
     {
         var list  = track.clips.ToList();
         var datas = track.data.clips.ToList();
         if (list.Contains(clip))
         {
             return(false);
         }
         else
         {
             list.Add(clip);
             datas.Add(data);
             list.Sort((x, y) => x.start.CompareTo(y.start));
             datas.Sort((x, y) => x.start.CompareTo(y.start));
             track.clips      = list.ToArray();
             track.data.clips = datas.ToArray();
             return(true);
         }
     }
 }
コード例 #3
0
ファイル: VirtualClip.cs プロジェクト: Yitzchok/Splicer
 public VirtualClip(double offset, double duration, double mediaStart, IClip sourceClip)
 {
     _offset     = offset;
     _duration   = duration;
     _mediaStart = mediaStart;
     _sourceClip = sourceClip;
 }
コード例 #4
0
            public SerializedClip GetClip(string currentId, char choice, SampleContainerChildType loopType)
            {
                IClip clip = null;

                if (string.IsNullOrEmpty(currentId) || !currentId.StartsWith(id))
                {
                    clip = list[UnityEngine.Random.Range(0, list.Count)];
                }
                else
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        if (currentId.StartsWith(list[i].id))
                        {
                            clip = list[i];
                            break;
                        }
                    }
                }
                if (clip is SerializedClip)
                {
                    return(clip as SerializedClip);
                }
                return((clip as IClipContainer).GetClip(currentId, choice, loopType));
            }
コード例 #5
0
ファイル: TrackFixture.cs プロジェクト: Yitzchok/Splicer
        public void EnsureClipBubblesBeforeAndAfterEffectAddedUp()
        {
            int beforeCount = 0;
            int afterCount  = 0;

            using (ITimeline timeline = new DefaultTimeline())
            {
                IGroup group = timeline.AddAudioGroup();
                ITrack track = group.AddTrack();
                track.BeforeEffectAdded += new EventHandler(delegate
                {
                    beforeCount++;
                });
                track.AfterEffectAdded += new EventHandler <AfterEffectAddedEventArgs>(delegate
                {
                    afterCount++;
                });

                IClip clip = track.AddClip("testinput.mp3", GroupMediaType.Audio, InsertPosition.Absoloute, 0, 0, -1);
                clip.AddEffect(0, 1, StandardEffects.CreateDefaultBlur());

                Assert.AreEqual(1, beforeCount);
                Assert.AreEqual(1, afterCount);
            }
        }
コード例 #6
0
ファイル: Track.cs プロジェクト: Yitzchok/Splicer
 protected void OnAfterClipAdded(IClip clip)
 {
     if (_afterClipAdded != null)
     {
         _afterClipAdded(this, new AfterClipAddedEventArgs(clip, this));
     }
 }
コード例 #7
0
            private IClipContainer EnsureContainerFor(string childId)
            {
                ParseId(childId, out string containerId, out string localId);
                if (string.IsNullOrEmpty(containerId))
                {
                    return(null);
                }
                IClipContainer clipContainer = GetContainer(containerId);

                if (clipContainer == null)
                {
                    SampleContainerChildType childType = GetChildType(localId);
                    clipContainer           = CreateContainer(containerId, childType);
                    containers[containerId] = clipContainer;
                    IClipContainer clipContainer2 = EnsureContainerFor(containerId);
                    if (clipContainer2 == null)
                    {
                        root = clipContainer;
                    }
                    else
                    {
                        ParseId(containerId, out string _, out string localId2);
                        clipContainer2.SetChild(localId2, clipContainer);
                    }
                    if (clipContainer is LoopContainer)
                    {
                        isLoop = true;
                    }
                    if (clipContainer is SwitchContainer)
                    {
                        isSwitch = true;
                    }
                }
                return(clipContainer);
            }
コード例 #8
0
        protected override void OnInspectorClip(IClip clip)
        {
            base.OnInspectorClip(clip);
            XPostprocessClip postClip = clip as XPostprocessClip;

            postClip?.OnInspector(SeqenceWindow.inst.Repaint);
        }
コード例 #9
0
 /// <inheritdoc />
 public void Play(IClip clip)
 {
     if (clip != null)
     {
         Play(clip.Name);
     }
 }
コード例 #10
0
        public void AddEffectSetsApropriateContainer()
        {
            using (ITimeline timeline = new DefaultTimeline())
            {
                EffectDefinition def = StandardEffects.CreateDefaultBlur();

                IGroup  group       = timeline.AddVideoGroup(24, 100, 100);
                IEffect groupEffect = group.AddEffect(0, 10, def);
                Assert.AreSame(group, groupEffect.Group);
                Assert.AreSame(group, groupEffect.Container);

                ITrack  track       = group.AddTrack();
                IEffect trackEffect = track.AddEffect(0, 10, def);
                Assert.AreSame(group, trackEffect.Group);
                Assert.AreSame(track, trackEffect.Container);

                IComposition composition       = group.AddComposition();
                IEffect      compositionEffect = composition.AddEffect(0, 10, def);
                Assert.AreSame(group, compositionEffect.Group);
                Assert.AreSame(composition, compositionEffect.Container);

                IClip   clip       = track.AddClip("..\\..\\image1.jpg", GroupMediaType.Image, InsertPosition.Absolute, 0, 0, 10);
                IEffect clipEffect = clip.AddEffect(0, 10, def);
                Assert.AreSame(group, clip.Group);
                Assert.AreSame(clip, clipEffect.Container);
            }
        }
コード例 #11
0
        public IAudioVideoClipPair AddVideoWithAudio(string name, string fileName, InsertPosition position,
                                                     double offset, double clipStart, double clipEnd,
                                                     bool shadowCopyAudio)
        {
            string audioFile = null;

            if (shadowCopyAudio)
            {
                audioFile = Path.Combine(TemporaryStoragePath,
                                         string.Format(CultureInfo.InvariantCulture,
                                                       Resources.TemporaryAudioFilenameTemplate, Guid.NewGuid(),
                                                       Path.GetExtension(fileName)));
                File.Copy(fileName, audioFile);
            }
            else
            {
                audioFile = fileName;
            }

            IClip audioClip = AddClip(name, audioFile, GroupMediaType.Audio, position, offset, clipStart, clipEnd,
                                      shadowCopyAudio);
            IClip videoClip = AddVideo(name, fileName, position, offset, clipStart, clipEnd);

            return(new AudioVideoClipPair(audioClip, videoClip));
        }
コード例 #12
0
ファイル: XTrack.cs プロジェクト: zxsean/seqence
        protected void BuildMix(float start, float duration, IClip clip1, IClip clip2)
        {
            var mix = SharedPool <MixClip> .Get();

            mix.Initial(start, duration, clip1, clip2);
            AddMix(mix);
        }
コード例 #13
0
 private void OnAddedClip(IClip clip)
 {
     if (_afterClipAdded != null)
     {
         _afterClipAdded(this, new AddedClipEventArgs(clip, this));
     }
 }
コード例 #14
0
        public void RenderWmvWithImageWatermark()
        {
            string outputFile = "RenderWmvWithImageWatermark.wmv";

            using (Image waterMarkImage = Image.FromFile("..\\..\\corner_watermark.png"))
                using (ITimeline timeline = new DefaultTimeline())
                {
                    IGroup videoGroup = timeline.AddVideoGroup(32, 320, 240);
                    ITrack videoTrack = videoGroup.AddTrack();

                    IClip videoClip =
                        videoTrack.AddClip("..\\..\\transitions.wmv", GroupMediaType.Video, InsertPosition.Absolute, 0, 0, 2);

                    IGroup audioGroup = timeline.AddAudioGroup();
                    ITrack audioTrack = audioGroup.AddTrack();
                    audioTrack.AddClip("..\\..\\testinput.mp3", GroupMediaType.Audio, InsertPosition.Absolute, 0, 0, 2);

                    ICallbackParticipant[] videoParticipants =
                        new ICallbackParticipant[]
                    { new ImageWatermarkParticipant(32, 320, 240, true, waterMarkImage, new Point(200, 0)) };

                    using (
                        WindowsMediaRenderer renderer =
                            new WindowsMediaRenderer(timeline, outputFile, WindowsMediaProfiles.HighQualityVideo,
                                                     videoParticipants, null))
                    {
                        renderer.Render();
                    }
                }
        }
コード例 #15
0
        /// <inheritdoc />
        public void Play(IClip clip)
        {
            if (clip != null && _currentClip != clip)
            {
                _currentClip       = clip;
                _currentTime       = 0f;
                _currentFrameIndex = _currentClip.RandomStart ? UnityEngine.Random.Range(0, _currentClip.FrameCount) : 0;
                HandleFrame(_currentFrameIndex);
                _isPlaying = true;

                // Play Children
                if (_children != null && _children.Length > 0)
                {
                    for (var i = 0; i < _children.Length; i++)
                    {
                        var animator = _children[i];
                        if (animator != null && animator.ChildMode != AnimatorChildMode.IgnoreParent)
                        {
                            if (animator.ChildMode == AnimatorChildMode.PlayWithParent)
                            {
                                animator.Play(clip.Name);
                            }
                            else if (animator.ChildMode == AnimatorChildMode.ShareClipsWithParent)
                            {
                                animator.Play(clip);
                            }
                        }
                    }
                }
            }
        }
コード例 #16
0
 /// <inheritdoc />
 public void Dispose()
 {
     OnClipComplete = null;
     OnFrameChanged = null;
     OnTrigger      = null;
     _currentClip   = null;
 }
コード例 #17
0
        public void RemoveClipEventHandlers()
        {
            int count = 0;

            EventHandler incrementBefore = delegate { count++; };

            EventHandler <AddedEffectEventArgs> incrementAfter =
                delegate { count++; };

            using (ITimeline timeline = new DefaultTimeline())
            {
                IClip clip =
                    timeline.AddAudioGroup().AddTrack().AddClip("testinput.wav", GroupMediaType.Audio,
                                                                InsertPosition.Absolute, 0, 0, -1);
                clip.AddedEffect  += incrementAfter;
                clip.AddingEffect += incrementBefore;

                clip.AddEffect(0, 2, StandardEffects.CreateDefaultBlur());
                Assert.AreEqual(2, count);

                count              = 0;
                clip.AddedEffect  -= incrementAfter;
                clip.AddingEffect -= incrementBefore;

                clip.AddEffect(0, 2, StandardEffects.CreateDefaultBlur());

                Assert.AreEqual(0, count);
            }
        }
コード例 #18
0
        public void JumpVolume()
        {
            // and audible demonstration of the difference between interpolating
            // parameter values for an effect, and jumping directly to them.

            string outputFile = "JumpVolume.wma";

            using (ITimeline timeline = new DefaultTimeline())
            {
                IGroup group = timeline.AddAudioGroup();
                ITrack track = group.AddTrack();
                IClip  clip  = track.AddClip("testinput.mp3", GroupMediaType.Audio, InsertPosition.Relative, 0, 0, 10);

                EffectDefinition effectDefinition = new EffectDefinition(DxtSubObjects.AudioMixer);

                Parameter volumeParameter = new Parameter("Vol", 0.0, 2, 1.0);
                volumeParameter.Intervals.Add(new Interval(IntervalMode.Jump, 2.5, "0.2"));
                volumeParameter.Intervals.Add(new Interval(IntervalMode.Jump, 3.5, "0.8"));
                volumeParameter.Intervals.Add(new Interval(IntervalMode.Jump, 4.5, "0.2"));
                volumeParameter.Intervals.Add(new Interval(IntervalMode.Jump, 5, "1.0"));
                volumeParameter.Intervals.Add(new Interval(IntervalMode.Interpolate, clip.Duration, "0.0"));

                effectDefinition.Parameters.Add(volumeParameter);

                clip.AddEffect(0, clip.Duration, effectDefinition);

                using (
                    IRenderer renderer =
                        new WindowsMediaRenderer(timeline, outputFile, WindowsMediaProfiles.MediumQualityAudio))
                {
                    renderer.Render();
                }
            }
        }
コード例 #19
0
 public GeometryStage()
 {
     vertexShade       = new VertexShade();
     primitiveAssemble = new PrimitiveAssemble();
     clip = new Clip();
     cull = new Cull();
 }
コード例 #20
0
ファイル: TypeUtilities.cs プロジェクト: winrainy/seqence
        public static EditorClip InitClipObject(EditorTrack tr, IClip c)
        {
            var t     = GetClipAsset(c.GetType());
            var c_obj = t != null ? (EditorClip)Activator.CreateInstance(t) : new EditorClip();

            c_obj?.Init(tr, c);
            return(c_obj);
        }
コード例 #21
0
 public void ConstructWithNullAudioClip()
 {
     using (ITimeline timeline = new DefaultTimeline())
     {
         IClip videoClip = timeline.AddVideoGroup(24, 100, 100).AddTrack().AddVideo("..\\..\\1sec.wmv");
         var   pair      = new AudioVideoClipPair(null, videoClip);
     }
 }
コード例 #22
0
        public AudioVideoClipPair(IClip audioClip, IClip videoClip)
        {
            if (audioClip == null) throw new ArgumentNullException(AudioClipParameter);
            if (videoClip == null) throw new ArgumentNullException(VideoClipParameter);

            _audioClip = audioClip;
            _videoClip = videoClip;
        }
コード例 #23
0
ファイル: MixClip.cs プロジェクト: winrainy/seqence
 public void Initial(float start, float duration, IClip clip1, IClip clip2)
 {
     this.start    = start;
     this.duration = duration;
     blendA        = clip1;
     blendB        = clip2;
     connect       = false;
 }
コード例 #24
0
 public void ConstructWithNullVideoClip()
 {
     using (ITimeline timeline = new DefaultTimeline())
     {
         IClip audioClip = timeline.AddAudioGroup().AddTrack().AddAudio("..\\..\\1sec.wav");
         var   pair      = new AudioVideoClipPair(audioClip, null);
     }
 }
コード例 #25
0
        public IAudioVideoClipPair AddVideoWithAudio(string name, string fileName, InsertPosition position,
                                                     double offset, double clipStart, double clipEnd)
        {
            IClip audioClip = AddAudio(name, fileName, position, offset, clipStart, clipEnd);
            IClip videoClip = AddVideo(name, fileName, position, offset, clipStart, clipEnd);

            return(new AudioVideoClipPair(audioClip, videoClip));
        }
コード例 #26
0
ファイル: IReloadService.cs プロジェクト: nagahole/scope
 public virtual void Reload(IClip clip, System.Func <int> getReserveAmmo, System.Action <int> callback = null)
 {
     if (getReserveAmmo() <= 0 || IsReloading())
     {
         return;
     }
     reloadCoroutine = Timing.RunCoroutine(_HandleReload(clip, getReserveAmmo, callback));
 }
コード例 #27
0
        public void Play_NullClip_NothingHappens()
        {
            IClip clip = null;

            _animator.Play(clip);
            Assert.That(_animator.IsPlaying, Is.False);
            Assert.That(_animator.CurrentClip, Is.Null);
        }
コード例 #28
0
 private void AssignScriptObjects(IClip clip)
 {
     m_Engine.Script["input"]    = clip;
     m_Engine.Script["Script"]   = new Script();
     m_Engine.Script["Gpu"]      = Renderer.Dx9GpuInfo.Details;
     m_Engine.Script["__$xhost"] = new InternalHostFunctions();
     m_Engine.Script["Host"]     = new Host();
 }
コード例 #29
0
ファイル: TimeScaleClip.cs プロジェクト: xoxota99/Myre
        public TimeScaleClip(IClip inner, float scale)
        {
            _inner = inner;
            _scale = scale;

            _duration = TimeSpan.FromTicks((long)(_inner.Duration.Ticks / _scale));
            _channels = Enumerable.Range(0, _inner.ChannelCount).Select(i => new TimeScaleChannel(_inner.GetChannel(i), _scale)).ToArray<IChannel>();
        }
コード例 #30
0
 private bool IsInRange(IClip clip, float t)
 {
     if (clip != null)
     {
         return(t < clip.end && t > clip.start);
     }
     return(false);
 }
コード例 #31
0
ファイル: EditorClip.cs プロジェクト: ylmbtm/seqence
 public EditorClip(EditorTrack tr, IClip c)
 {
     this.track = tr;
     this.clip  = c;
     rect       = Rect.zero;
     dragMode   = DragMode.None;
     e          = Event.current;
     clipMode   = ClipMode.None;
 }
コード例 #32
0
        protected virtual void OnInspectorClip(IClip clip)
        {
            clip.start = EditorGUILayout.FloatField("start", clip.start);
            float d = EditorGUILayout.FloatField("duration", clip.duration);

            if (d > 0)
            {
                clip.duration = d;
            }
        }
コード例 #33
0
        private static object GetIcon(IClip clip)
        {
            //if (clip.TargetType == MediaType.VideoAvi)
            //{
            //    return "pack://application:,,,/Images/File Video AVI-01.png";
            //}
            //else if (clip.TargetType == MediaType.VideoMpeg)
            //{
            //    return "pack://application:,,,/Images/File Video MPEG-01.png";
            //}
            //else if (clip.TargetType == MediaType.VideoWmv)
            //{
            //    return "pack://application:,,,/Images/File Video WMV-01.png";
            //}

            return "pack://application:,,,/Images/File Video-01.png";
        }
コード例 #34
0
        protected override void calculate()
        {
            #region khoi dau
            base.calculate();
            CalculationEventArg evt = new CalculationEventArg();
            //evt.Type = EnumTypeOfLoopCalculation.InListCalculators;
            evt.CurrentIndexCalculator = this._index;
            evt.Log = string.Format("**********  Bắt đầu tính cho thửa nông nghiệp ở vị trí {0} ********", vitri);
            onCalculating(evt);
            #endregion

            //[thaydoi] - them cac khai bao can thiet
            //************************************
            #region khai bao cac bien
            //Lay connection info hien tai
            SdeConnection conn = new SdeConnection();
            ISdeConnectionInfo sdeConn = conn as ISdeConnectionInfo;
            IWorkspaceEdit wspEdit = (IWorkspaceEdit)sdeConn.Workspace;
            IMultiuserWorkspaceEdit mwspEdit = (IMultiuserWorkspaceEdit)sdeConn.Workspace;
            this._fcName = new TnFeatureClassName(sdeConn.Workspace);
            this._tblName = new TnTableName(sdeConn.Workspace);
            IFeatureWorkspace fw = (IFeatureWorkspace)sdeConn.Workspace;
            ICopyFeatures copyTool = new DataManager(sdeConn.Workspace,sdeConn.Environment);

            #region thua
            string thuaName = string.Format("{0}_{1}", DataNameTemplate.Thua, this._currentConfig.NamApDung);
            _fcName.FC_THUA.NAME = thuaName;
            _fcName.FC_THUA.InitIndex();
            IFeatureClass thuaFeatureClass = fw.OpenFeatureClass(thuaName);
            IFeatureLayer thuaFeatureLayer = new FeatureLayerClass();
            thuaFeatureLayer.FeatureClass = thuaFeatureClass;
            IFeatureSelection thuaFeatureSelection;
            #endregion
            #region xa
            IFeatureClass xaFeatureClass = fw.OpenFeatureClass(DataNameTemplate.Ranh_Xa_Poly);
            IFeatureLayer xaFeatureLayer = new FeatureLayerClass();
            xaFeatureLayer.FeatureClass = xaFeatureClass;
            IFeatureSelection xaFeatureSelection;
            #endregion
            #region duong
            IFeatureClass duongFeatureClass = fw.OpenFeatureClass(DataNameTemplate.Duong);
            IFeatureLayer duongFeatureLayer = new FeatureLayerClass();
            duongFeatureLayer.FeatureClass = duongFeatureClass;
            IFeatureSelection duongFeatureSelection;
            //_fcName.FC_DUONG.InitIndex();
            #endregion

            #region thua gia dat
            string tgd = string.Format("{0}_{1}", DataNameTemplate.Thua_Gia_Dat_Draft, this._currentConfig.NamApDung);
            _fcName.FC_THUA_GIADAT_DRAFT.NAME = tgd;
            _fcName.FC_THUA_GIADAT_DRAFT.InitIndex();
            //_fcName.FC_THUA_GIADAT_DRAFT.NAME = tgd;
            //_fcName.FC_THUA_GIADAT_DRAFT.InitIndex();
            IFeatureClass tgdFeatureClass=null;
            try
            {
                tgdFeatureClass = fw.OpenFeatureClass(tgd);
            }
            catch (Exception exc)
            {
                evt.Log = string.Format("Không tìm thấy lớp dữ liệu: {0}", tgd);
                onCalculating(evt);
                onFinished(evt);
                return;
            }
            ITable tblThuaGiaDat = (ITable)tgdFeatureClass;
            IFeatureLayer tgdFeatureLayer = new FeatureLayerClass();
            ISDETableEditor sdeTblTgdEditor = new SDETable(tblThuaGiaDat, sdeConn.Workspace);
            #endregion

            #region gia dat duong
            //string gdd = string.Format("{0}_{1}", DataNameTemplate.Gia_Dat_Duong, this._currentConfig.NamApDung);
            //_tblName.GIA_DAT_DUONG.NAME = gdd;
            //_tblName.GIA_DAT_DUONG.InitIndex();
            #endregion

            #region ten duong
            ITable tblTenDuong;
            try
            {
                tblTenDuong = fw.OpenTable(DataNameTemplate.Ten_Duong);
            }
            catch (Exception exc)
            {
                evt.Log = string.Format("Không tìm thấy lớp dữ liệu: {0}", DataNameTemplate.Ten_Duong);
                onCalculating(evt);
                onFinished(evt);
                return;
            }
            #endregion

            #region loai dat
            ITable tblLoaiDat;
            try
            {
                tblLoaiDat = fw.OpenTable(DataNameTemplate.Loai_Dat);
            }
            catch (Exception exc)
            {
                evt.Log = string.Format("Không tìm thấy lớp dữ liệu: {0}", DataNameTemplate.Loai_Dat);
                onCalculating(evt);
                onFinished(evt);
                return;
            }
            #endregion

            #region he so vi tri
            ITable tblHesoVitri;
            try
            {
                tblHesoVitri = fw.OpenTable(DataNameTemplate.He_So_K);
            }
            catch (Exception exc)
            {
                evt.Log = string.Format("Không tìm thấy lớp dữ liệu: {0}", DataNameTemplate.He_So_K);
                onCalculating(evt);
                onFinished(evt);
                return;
            }
            #endregion

            #region khac
            IQueryFilter qrf = new QueryFilterClass();
            bool result = false;
            int sothuatimthay = 0;
            int sothuatinhduoc = 0;
            int sothuaKhongTinhDuoc = 0;
            _dataManager = new DataManager(sdeConn.Workspace, sdeConn.Environment);
            _version = SdeVersionsTool.CallMe();
            _clipTool = new GExtractTool(sdeConn.Environment);
            string duongBuffer100mNoSde = FilterSdeLayerName.GetActualName(DataNameTemplate.Duong_Buffer_);
            duongBuffer100mNoSde += _currentConfig.DSauDuongVitri1Nn;
            string thuaClip100mNoSde = FilterSdeLayerName.GetActualName(DataNameTemplate.Thua_Clip_);
            thuaClip100mNoSde += _currentConfig.DSauDuongVitri1Nn;
            string duongBuffer100mCoSde = string.Format("{0}{1}", DataNameTemplate.Duong_Buffer_, _currentConfig.DSauDuongVitri1Nn);
            string thuaClip100mCoSde = string.Format("{0}{1}", DataNameTemplate.Thua_Clip_, _currentConfig.DSauDuongVitri1Nn);
            #endregion

            #endregion
            //************************************

            //*******************************************
            //===========================================
            //===========================================

            #region bat dau tinh

            _bufferTool = new GProximityTool(sdeConn.Environment);

            if (!_dataManager.LayerExist(duongBuffer100mNoSde))
            {

                _bufferTool.BufferInsideSde(duongFeatureClass.AliasName, duongBuffer100mNoSde, _currentConfig.DSauDuongVitri1Nn);
            }
            IFeatureClass duongBuff100FeatureClass = fw.OpenFeatureClass(duongBuffer100mNoSde);
            IFeatureLayer duongBuff100FeatureLayer = new FeatureLayerClass();
            ISelectionSet duongBuff100Sls;
            IFeatureSelection duongBuff100Fsls;
            duongBuff100FeatureLayer.FeatureClass = duongBuff100FeatureClass;

            //[thaydoi] - cac may tinh khac chi can thay dieu kien truy van he so vi tri
            //******************************************************************
            #region lay cac quy tac tim vi tri

            #region log---
            evt.Log = string.Format("\n----Lấy các quy tắc tìm vị trí thửa từ bảng {0}, ứng với hệ số {1} ...", DataNameTemplate.He_So_K, TnHeSoK.DatNongNghiepVt1Hon100m);
            onCalculating(evt);
            #endregion

            qrf.WhereClause = string.Format("{0}='{1}'", "hesovitri", TnHeSoK.DatNongNghiepVt1Hon100m);
            ICursor cur = tblHesoVitri.Search(qrf, false);
            string quytac = "";
            string cachtinh = "";
            string cachtinhdongia = "";
            try
            {
                IRow row = cur.NextRow();
                if (row != null)
                {
                    quytac = row.get_Value(_tblName.HESO_VITRI.GetIndex(_tblName.HESO_VITRI.QUY_TAC)).ToString();
                    cachtinh = row.get_Value(_tblName.HESO_VITRI.GetIndex(_tblName.HESO_VITRI.CACH_TINH)).ToString();
                    cachtinhdongia = row.get_Value(_tblName.HESO_VITRI.GetIndex(_tblName.HESO_VITRI.CACH_TINH_DON_GIA)).ToString();
                }
            }
            catch { }
            finally
            {
                Marshal.ReleaseComObject(cur);
            }
            #endregion

            #region tinh theo xa
            if (this._inputParams.MA_XA != "-1")
            {
                //[kodoi]
                //=======================
                #region chon xa co ma dang xet
                //neu dang tinh cho 1 xa
                if (_inputParams.MA_XA != "*")
                {
                    qrf.WhereClause = string.Format("{0}='{1}'", _fcName.FC_RANH_XA_POLY.MA_XA, _inputParams.MA_XA);
                }
                else//neu dang tinh cho toan huyen
                {
                    qrf.WhereClause = "";
                }
                ISelectionSet xaSelectionSet = xaFeatureClass.Select(qrf, esriSelectionType.esriSelectionTypeHybrid, esriSelectionOption.esriSelectionOptionOnlyOne, sdeConn.Workspace);
                xaFeatureSelection = (IFeatureSelection)xaFeatureLayer;
                xaFeatureSelection.SelectionSet = xaSelectionSet;
                #endregion
                //=======================

                #region vong lap tung xa

                //[thaydoi] - co the them bien chay
                //*************************
                #region khoi dau
                IEnumIDs xaIds = xaSelectionSet.IDs;
                int xaId = 0;
                IFeature xaFt = null;
                List<object> lstMaDuong = new List<object>();
                #endregion
                //*************************

                while ((xaId = xaIds.Next()) != -1)
                {
                    //[kodoi]
                    //=======================
                    #region lay thong tin xa
                    xaFt = xaFeatureClass.GetFeature(xaId);
                    string maxa = xaFt.get_Value(xaFt.Fields.FindField(_fcName.FC_RANH_XA_POLY.MA_XA)).ToString();
                    string tenxa = xaFt.get_Value(xaFt.Fields.FindField(_fcName.FC_RANH_XA_POLY.TEN_XA)).ToString();
                    string loaixa = xaFt.get_Value(xaFt.Fields.FindField(_fcName.FC_RANH_XA_POLY.MA_LOAI_XA)).ToString();
                    #endregion

                    #region -----log
                    evt.Log = string.Format("\n************************************************");
                    evt.Log += string.Format("\n******   Đang tính cho xã/phường: {0}  ******", tenxa);
                    evt.Log += string.Format("\n************************************************");
                    onCalculating(evt);
                    #endregion

                    #region tim duong trong khu vuc do thi bang qua xa
                    //chon xa dang xet
                    qrf.WhereClause = string.Format("{0}='{1}'", _fcName.FC_RANH_XA_POLY.OID, xaId);
                    xaSelectionSet = xaFeatureClass.Select(qrf, esriSelectionType.esriSelectionTypeHybrid, esriSelectionOption.esriSelectionOptionOnlyOne, sdeConn.Workspace);
                    xaFeatureSelection = (IFeatureSelection)xaFeatureLayer;
                    xaFeatureSelection.SelectionSet = xaSelectionSet;
                    //Chon cac duong co do rong theo quy dinh
                    qrf.WhereClause = "";//string.Format("{0}='{1}'", _fcName.FC_DUONG.PHAN_LOAI, _isDothi);// "maduong='2'";
                    ISelectionSet duongSelectionSet = duongFeatureClass.Select(qrf, esriSelectionType.esriSelectionTypeHybrid, esriSelectionOption.esriSelectionOptionNormal, sdeConn.Workspace);
                    duongFeatureSelection = (IFeatureSelection)duongFeatureLayer;
                    duongFeatureSelection.SelectionSet = duongSelectionSet;

                    //bat dau truy van khong gian
                    _qrBl.FromLayer = duongFeatureLayer;
                    _qrBl.ByLayer = xaFeatureLayer;
                    _qrBl.LayerSelectionMethod = esriLayerSelectionMethod.esriLayerSelectIntersect;
                    _qrBl.ResultType = esriSelectionResultEnum.esriSelectionResultAnd;
                    _qrBl.UseSelectedFeatures = true;

                    duongSelectionSet = _qrBl.Select();

                    #endregion
                    //=======================

                    #region vong lap xet tung duong

                    //[thaydoi] - co the them bien chay
                    //===============================
                    #region khoi dau
                    IEnumIDs eIds = duongSelectionSet.IDs;
                    int duongId;
                    IFeature ftDuong;
                    int iDuong = 0;
                    int progressingTotalCount = 1;
                    evt.Reset();
                    evt.ProgressingTotal = duongSelectionSet.Count;
                    onCalculating(evt);

                    #endregion
                    //================================

                    while ((duongId = eIds.Next()) != -1)
                    {
                        //[kodoi]
                        //======================
                        #region log-----
                        evt.Reset();
                        evt.ProgressingTotalCount = progressingTotalCount;
                        onCalculating(evt);
                        progressingTotalCount++;
                        #endregion
                        //======================

                        //[capnhat] - lay ten duong tu bang ten duong
                        //++++++++++++++++++++++++
                        #region lay thong tin cua duong dang xet

                        ftDuong = duongFeatureClass.GetFeature(duongId);
                        double dorongDuong;
                        result = double.TryParse(ftDuong.get_Value(_fcName.FC_DUONG.GetIndex(_fcName.FC_DUONG.DO_RONG)).ToString(), out dorongDuong);
                        if (!result)
                        {
                            dorongDuong = 0;
                        }
                        if (dorongDuong < _currentConfig.DRongDuongVitri1Nn)
                        {
                            continue;
                        }
                        string tenduong = "";//ftDuong.get_Value(_fcName.FC_DUONG.GetIndex(_fcName.FC_DUONG.TEN_DUONG)).ToString();
                        object maduong = ftDuong.get_Value(_fcName.FC_DUONG.GetIndex(_fcName.FC_DUONG.MA_DUONG));
                        lstMaDuong.Add(maduong);
                        string batdau = "";// ftDuong.get_Value(_fcName.FC_DUONG.GetIndex(_fcName.FC_DUONG.BAT_DAU)).ToString();
                        string ketthuc = "";// ftDuong.get_Value(_fcName.FC_DUONG.GetIndex(_fcName.FC_DUONG.KET_THUC)).ToString();

                        #endregion
                        //++++++++++++++++++++++++

                        //[kodoi]
                        //Chon duong dang xet, buoc này de ra layer duong dung de truy van khong gian cac thua dat
                        //====================
                        #region chon duong dang xet
                        qrf.WhereClause = string.Format("{0}='{1}'", _fcName.FC_DUONG.OID, duongId);
                        duongSelectionSet = duongFeatureClass.Select(qrf, esriSelectionType.esriSelectionTypeHybrid, esriSelectionOption.esriSelectionOptionOnlyOne, sdeConn.Workspace);
                        duongFeatureSelection = (IFeatureSelection)duongFeatureLayer;

                        duongFeatureSelection.SelectionSet = duongSelectionSet;
                        #endregion
                        //====================

                        //tim cac thua theo dieu kien mat tien
                        #region tinh vi tri cho cac thua
                        //doc cach tim thua trong bang he so vi tri
                        //lay cach tim cho dat o
                        //truyen thong so cach tinh,thualayer,duonglayer,khoangcach

                        //MessageBox.Show(func);
                        //func = "ChongLop([INTERSECT],[NEW_SELECTION],1) Then ChongLop([CONTAINED_BY],[AND_SELECTION],50)";

                        //[kodoi]
                        //============================
                        #region tim cac thua theo vi tri quy dinh
                        thuaFeatureSelection = (IFeatureSelection)thuaFeatureLayer;
                        thuaFeatureSelection.Clear();
                        Evaluation eval = new Evaluation(quytac);
                        eval.ThuaLayer = thuaFeatureLayer;
                        eval.DuongLayer = duongFeatureLayer;
                        eval.EvaluateQuery();
                        //thuaFeatureSelection = (IFeatureSelection)thuaFeatureLayer;
                        ISelectionSet thuaSelectionSet = thuaFeatureSelection.SelectionSet;
                        #endregion
                        //============================

                        //MessageBox.Show(thuaSelectionSet.Count.ToString());
                        #endregion

                        #region clip cac thua vua tim duoc

                        #region delete bang thua_sau100m_clip
                        IFeatureClass thuaClipFc = null;
                        #region log---
                        evt.Log = string.Format("\n----Kiểm tra, xóa bảng {0} ...", thuaClip100mCoSde);
                        onCalculating(evt);
                        #endregion

                        if (_dataManager.LayerExist(thuaClip100mNoSde))
                        {
                            //thuaClipFc = fw.OpenFeatureClass("sde.thua_sau50m_clip");
                            //mwspEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMVersioned);
                            //wspEdit.StartEditing(false);
                            //wspEdit.StartEditOperation();
                            ((IFeatureClassManager)_dataManager).DeleteFcInSde(thuaClip100mCoSde);
                            //((IDataset)thuaClipFc).Delete();
                            //wspEdit.StopEditOperation();
                            //wspEdit.StopEditing(true);
                        }
                        #endregion

                        #region chon duong buffer 100 dang xet
                        qrf.WhereClause = string.Format("{0}='{1}'", _fcName.FC_DUONG.OID, duongId);
                        duongBuff100Sls = duongBuff100FeatureClass.Select(qrf, esriSelectionType.esriSelectionTypeHybrid, esriSelectionOption.esriSelectionOptionOnlyOne, sdeConn.Workspace);
                        duongBuff100Fsls = (IFeatureSelection)duongBuff100FeatureLayer;
                        duongBuff100Fsls.SelectionSet = duongBuff100Sls;
                        #endregion

                        #region log---
                        evt.Log = string.Format("\n----Kiểm tra, clip thửa theo đường buffer {0}m, lưu vào bảng {1} ...", _currentConfig.DSauDuongVitri1Nn, thuaClip100mCoSde);
                        onCalculating(evt);
                        #endregion

                        string thualyr = string.Format("{0}/{1}", _sysTempPath.TempPath, thuaClip100mNoSde);
                        string duonglyr = string.Format("{0}/{1}", _sysTempPath.TempPath, duongBuffer100mNoSde);
                        _clipTool.ClipByLayerFileInsideSde(thuaFeatureLayer, thualyr, duongBuff100FeatureLayer, duonglyr, thuaClip100mNoSde);
                        try
                        {
                            thuaClipFc = fw.OpenFeatureClass(thuaClip100mCoSde);
                        }
                        catch (Exception ex) { continue; }
                        _version.RegisterDataset((IDataset)thuaClipFc, true, true);
                        #endregion

                        //[kodoi]
                        //============================
                        #region ----log
                        if (thuaSelectionSet.Count == 0)
                        {
                            evt.Log = string.Format("\n !!! Không tìm thấy thửa nào tiếp giáp với đường {0} đoạn từ {1} đến {2} và nằm trong vùng buffer 50m", tenduong, batdau, ketthuc);
                            onCalculating(evt);

                            #region report progressing duong
                            if (iDuong < duongSelectionSet.Count)
                            {
                                decimal i = (decimal)iDuong % (decimal)duongSelectionSet.Count * 100;
                                int i1 = Convert.ToInt32(i);
                                this._bgwCalculating.ReportProgress(i1);
                                //MessageBox.Show("log 009");
                            }
                            else
                            {
                                this._bgwCalculating.ReportProgress(99);
                            }
                            iDuong++;
                            #endregion

                            continue;
                        }
                        #endregion
                        sothuatimthay += thuaSelectionSet.Count;
                        //============================

                        #region xet tung thua

                        //[thaydoi] - co the them bien chay
                        //********************
                        #region khoi dau
                        IEnumIDs thuaIds = thuaSelectionSet.IDs;
                        int thuaId;
                        IFeature thuaFt;
                        int iThua = 0;
                        List<object[,]> pairColValTgd = new List<object[,]>();
                        int rowTgdNnHandleUpdate = 0;
                        List<object> newId = new List<object>();
                        #endregion
                        //********************

                        while ((thuaId = thuaIds.Next()) != -1)
                        {
                            int hesoVitri = TnHeSoK.DatNongNghiepVt1Hon100m;

                            //[thaydoi] - co them them dieu kien de xac dinh vi tri cua thua
                            //***********************************
                            #region lay thong tin thua dang xet

                            //[kodoi]
                            //============================
                            #region lay thong tin co ban
                            thuaFt = thuaFeatureClass.GetFeature(thuaId);
                            //neu thua bi khoa tim vi tri,bo qua,xet thua ke
                            string lockTimVitri = thuaFt.get_Value(thuaFt.Fields.FindField(_fcName.FC_THUA.LOCKED)).ToString();
                            if (lockTimVitri == "1")
                            {
                                sothuaKhongTinhDuoc++;

                                #region report progressing thua
                                if (iThua < thuaSelectionSet.Count)
                                {
                                    decimal i = (decimal)iThua / (decimal)thuaSelectionSet.Count * 100;
                                    int i1 = Convert.ToInt32(i);
                                    this._bgwCalculating.ReportProgress(i1);
                                    //MessageBox.Show("log 009");
                                }
                                else
                                {
                                    this._bgwCalculating.ReportProgress(99);
                                }
                                iThua++;
                                #endregion

                                continue;

                            }
                            //neu thua ko thuoc xa dang xet thi ko tinh tiep
                            object mathua = thuaFt.get_Value(thuaFt.Fields.FindField(_fcName.FC_THUA.MA_THUA));
                            object maxaThua = thuaFt.get_Value(thuaFt.Fields.FindField(_fcName.FC_THUA.MA_XA));
                            object dientichpl = thuaFt.get_Value(thuaFt.Fields.FindField(_fcName.FC_THUA.DIEN_TICH));
                            #endregion
                            //============================

                            //[kodoi]
                            //============================
                            #region kiem tra maxa
                            if (maxaThua.ToString() == "" || maxaThua == null)
                            {
                                maxaThua = "0";

                                #region ----log
                                evt.Log = string.Format("Chưa xác định mã xã cho thửa {0}", mathua);
                                #endregion

                                sothuaKhongTinhDuoc++;

                                #region report progressing thua
                                if (iThua < thuaSelectionSet.Count)
                                {
                                    decimal i = (decimal)iThua / (decimal)thuaSelectionSet.Count * 100;
                                    int i1 = Convert.ToInt32(i);
                                    this._bgwCalculating.ReportProgress(i1);
                                    //MessageBox.Show("log 009");
                                }
                                else
                                {
                                    this._bgwCalculating.ReportProgress(99);
                                }
                                iThua++;
                                #endregion

                                continue;
                            }
                            #region danh rieng khi tinh theo xa
                            else if (maxaThua.ToString() != maxa)
                            {
                                #region ----log
                                evt.Reset();
                                evt.Log = string.Format("thửa {0} không thuộc xã {1}", mathua, tenxa);
                                onCalculating(evt);
                                #endregion
                                sothuaKhongTinhDuoc++;
                                #region report progressing thua
                                if (iThua < thuaSelectionSet.Count)
                                {
                                    decimal i = (decimal)iThua / (decimal)thuaSelectionSet.Count * 100;
                                    int i1 = Convert.ToInt32(i);
                                    this._bgwCalculating.ReportProgress(i1);
                                    //MessageBox.Show("log 009");
                                }
                                else
                                {
                                    this._bgwCalculating.ReportProgress(99);
                                }
                                iThua++;
                                #endregion

                                continue;
                            }
                            #endregion
                            #endregion
                            //============================

                            #region lay loai dat

                            //neu ko co dat phi nong nghiep thi bo qua,xet thua ke
                            //neu co dat nong nghiep thi datnn=true
                            //neu la dat hon hop, neu co dat sxkd thi datsxkd=true,
                            //neu co dat o thi codato=true
                            //cac truong hop he so vi tri:
                            //o:3010, sxkd:4010, o+nn:5010, o+sxkd:6010
                            string loaidat = thuaFt.get_Value(thuaFt.Fields.FindField(_fcName.FC_THUA.LOAI_DAT)).ToString();
                            //evt.Log = string.Format("\n loai dat cua thua {0} la {1}", thuaId, loaidat);
                            //onCalculating(evt);

                            //[thaydoi] - may tinh dat nong nghiep co the khac
                            //***********************
                            #region kiem tra dat nong nghiep
                            bool codatnn = false;
                            object datnn = "";
                            foreach (string s in TnLoaiDats.NONG_NGHIEP)
                            {
                                if (loaidat == s)
                                {
                                    codatnn = true;
                                    datnn = s;
                                    break;
                                }
                                else
                                {
                                    codatnn = false;
                                }
                            }
                            if (!codatnn)
                            {
                                sothuaKhongTinhDuoc++;

                                #region report progressing thua
                                if (iThua < thuaSelectionSet.Count)
                                {
                                    decimal i = (decimal)iThua / (decimal)thuaSelectionSet.Count * 100;
                                    int i1 = Convert.ToInt32(i);
                                    this._bgwCalculating.ReportProgress(i1);
                                    //MessageBox.Show("log 009");
                                }
                                else
                                {
                                    this._bgwCalculating.ReportProgress(99);
                                }
                                iThua++;
                                #endregion

                                continue;
                            }
                            #endregion
                            //***********************

                            #endregion

                            #endregion
                            //***********************************

                            //[thaydoi] - thay doi he so vi tri phu hop
                            //***********************************
                            #region quyet dinh he so vi tri cho thua
                            if (codatnn)
                            {
                                hesoVitri = TnHeSoK.DatNongNghiepVt1Hon100m;
                            }
                            else
                            {
                                hesoVitri = TnHeSoK.KhongXacDinh;
                            }
                            #endregion
                            //***********************************

                            //[thaydoi] - thay doi dieu kien truy van ung voi tung may tinh khac nhau
                            //***********************************
                            #region kiem tra trong bang thua_giadat, voi dieu kien:mathua,maduong,hesovitri,khoagia=0
                            evt.Reset();
                            evt.Log = string.Format("\n[!]--- Kiểm tra các vị trí, cập nhật vị trí mới cho thửa {0} ...", mathua);
                            onCalculating(evt);
                            qrf.WhereClause = string.Format("({0}='{1}' or {2} is null) and {3}='{4}' and {5}='{6}' and {7}='{8}'",
                                _fcName.FC_THUA_GIADAT_DRAFT.LOCKED, 0, _fcName.FC_THUA_GIADAT_DRAFT.LOCKED,
                                _fcName.FC_THUA_GIADAT_DRAFT.MA_THUA, mathua,
                                _fcName.FC_THUA_GIADAT_DRAFT.MA_DUONG, maduong,
                                _fcName.FC_THUA_GIADAT_DRAFT.HE_SO_K, hesoVitri);
                            ICursor tgdFcs = tblThuaGiaDat.Search(qrf, false);
                            IRow tgdRow = null;
                            //MessageBox.Show(string.Format("line 1401 CalcPosThuaMattien - bat dau try, query:\n{0}", qrf.WhereClause));
                            try
                            {
                                tgdRow = tgdFcs.NextRow();//dam bao la chi co 1 hang ket qua
                                if (tgdRow != null)
                                {
                                    //MessageBox.Show("co");
                                    //kiem tra co cho phep tinh lai vi tri
                                    //neu co:xoa feater cu,them feature moi
                                    #region xet thua da co vi tri

                                    bool isOverWritePos = true;

                                    if (!isOverWritePos)
                                    {
                                        newId.Add(tgdRow.OID);
                                        //continue;
                                    }
                                    else
                                    {
                                        //[kodoi]
                                        //===================
                                        #region xoa feature cu
                                        wspEdit.StartEditing(true);
                                        wspEdit.StartEditOperation();
                                        //qrf.WhereClause = string.Format("{0}='{1}'", "OBJECTID", tgdRow.OID);
                                        //tblThuaGiaDat.DeleteSearchedRows(qrf);
                                        tgdRow.Delete();
                                        wspEdit.StopEditOperation();
                                        wspEdit.StopEditing(true);
                                        #endregion
                                        //===================

                                        #region chon trong bang thua clip
                                        qrf.WhereClause = string.Format("{0}='{1}'", _fcName.FC_THUA.MA_THUA, mathua);
                                        IFeatureCursor thuaClipFcur = thuaClipFc.Search(qrf, false);
                                        IFeature thuaClipFt = null;
                                        try
                                        {
                                            thuaClipFt = thuaClipFcur.NextFeature();
                                            if (thuaClipFt == null)
                                            {
                                                continue;
                                            }
                                        }
                                        catch (Exception ex) { continue; }
                                        finally { Marshal.ReleaseComObject(thuaClipFcur); }

                                        #region lay thong tin thua clip
                                        IArea area = (IArea)thuaClipFt.Shape;
                                        #endregion

                                        #endregion

                                        //[thaydoi] - them gia tri
                                        //**********************
                                        #region them feature moi
                                        object copiedId = null;
                                        try
                                        {
                                            mwspEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMVersioned);
                                            wspEdit.StartEditOperation();
                                            copiedId = copyTool.Copy(thuaClipFt, tgdFeatureClass);
                                            wspEdit.StopEditOperation();
                                            wspEdit.StopEditing(true);
                                        }
                                        catch (Exception ex)
                                        {
                                            wspEdit.AbortEditOperation();
                                            wspEdit.StopEditing(false);
                                        }

                                        //them gia tri mathua,maduong,hesovitri
                                        pairColValTgd.Add(new object[,] { { tgdRow.Fields.FindField(_fcName.FC_THUA_GIADAT_DRAFT.MA_THUA), mathua } });
                                        pairColValTgd.Add(new object[,] { { tgdRow.Fields.FindField(_fcName.FC_THUA_GIADAT_DRAFT.MA_DUONG), maduong } });
                                        pairColValTgd.Add(new object[,] { { tgdRow.Fields.FindField(_fcName.FC_THUA_GIADAT_DRAFT.HE_SO_K), hesoVitri } });
                                        pairColValTgd.Add(new object[,] { { _fcName.FC_THUA_GIADAT_DRAFT.GetIndex(_fcName.FC_THUA_GIADAT_DRAFT.DIEN_TICH_PHAP_LY), dientichpl } });
                                        sdeTblTgdEditor.CacheData(copiedId, rowTgdNnHandleUpdate, pairColValTgd, EnumTypeOfEdit.UPDATE);
                                        rowTgdNnHandleUpdate++;
                                        pairColValTgd.Clear();
                                        newId.Add(copiedId);
                                        #endregion
                                        //**********************
                                    }

                                    #endregion

                                }
                                else
                                {
                                    #region chon trong bang thua clip
                                    qrf.WhereClause = string.Format("{0}='{1}'", _fcName.FC_THUA.MA_THUA, mathua);
                                    IFeatureCursor thuaClipFcur = thuaClipFc.Search(qrf, false);
                                    IFeature thuaClipFt = null;
                                    try
                                    {
                                        thuaClipFt = thuaClipFcur.NextFeature();
                                        if (thuaClipFt == null)
                                        {
                                            continue;
                                        }
                                    }
                                    catch (Exception ex) { continue; }
                                    finally { Marshal.ReleaseComObject(thuaClipFcur); }

                                    #region lay thong tin thua clip
                                    IArea area = (IArea)thuaClipFt.Shape;
                                    #endregion

                                    #endregion

                                    //MessageBox.Show("ko co");
                                    //[thaydoi] - them cac gia tri thich hop vao thua_giadat
                                    //***********************************
                                    #region them feature moi
                                    object copiedId = null;
                                    try
                                    {
                                        mwspEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMVersioned);
                                        wspEdit.StartEditOperation();
                                        copiedId = copyTool.Copy(thuaClipFt, tgdFeatureClass);
                                        wspEdit.StopEditOperation();
                                        wspEdit.StopEditing(true);
                                    }
                                    catch (Exception ex)
                                    {
                                        wspEdit.AbortEditOperation();
                                        wspEdit.StopEditing(true);
                                    }

                                    //them gia tri mathua,maduong,hesovitri
                                    pairColValTgd.Add(new object[,] { { _fcName.FC_THUA_GIADAT_DRAFT.GetIndex(_fcName.FC_THUA_GIADAT_DRAFT.MA_THUA), mathua } });
                                    pairColValTgd.Add(new object[,] { { _fcName.FC_THUA_GIADAT_DRAFT.GetIndex(_fcName.FC_THUA_GIADAT_DRAFT.MA_DUONG), maduong } });
                                    pairColValTgd.Add(new object[,] { { _fcName.FC_THUA_GIADAT_DRAFT.GetIndex(_fcName.FC_THUA_GIADAT_DRAFT.HE_SO_K), hesoVitri } });
                                    pairColValTgd.Add(new object[,] { { _fcName.FC_THUA_GIADAT_DRAFT.GetIndex(_fcName.FC_THUA_GIADAT_DRAFT.DIEN_TICH_PHAP_LY), dientichpl } });
                                    sdeTblTgdEditor.CacheData(copiedId, rowTgdNnHandleUpdate, pairColValTgd, EnumTypeOfEdit.UPDATE);
                                    rowTgdNnHandleUpdate++;
                                    pairColValTgd.Clear();
                                    newId.Add(copiedId);
                                    #endregion
                                    //***********************************
                                }
                                //MessageBox.Show(newId.Count.ToString());
                            }
                            catch (Exception e1) { MessageBox.Show(string.Format("CalcPosThuaMattien, line 1448-\n{0}", e1)); }
                            finally { Marshal.ReleaseComObject(tgdFcs); }
                            #endregion
                            //***********************************

                            #region report progressing thua
                            if (iThua < thuaSelectionSet.Count)
                            {
                                decimal i = (decimal)iThua / (decimal)thuaSelectionSet.Count * 100;
                                int i1 = Convert.ToInt32(i);
                                this._bgwCalculating.ReportProgress(i1);
                                //MessageBox.Show("log 009");
                            }
                            else
                            {
                                this._bgwCalculating.ReportProgress(99);
                            }
                            iThua++;
                            #endregion
                        }
                        #endregion

                        //[kodoi]
                        //============================
                        #region luu thong tin vao bang gia dat
                        if (!sdeTblTgdEditor.IsEditing())
                        {
                            sdeTblTgdEditor.StartEditing(true);
                            sdeTblTgdEditor.StartEditOperation();
                        }

                        #region ----log
                        evt.Log = string.Format("\n----||| Đang lưu vị trí các thửa vào bảng {0} |||---- ", tgd);
                        onCalculating(evt);
                        #endregion

                        sdeTblTgdEditor.SaveEdit();
                        sdeTblTgdEditor.StopEditOperation();
                        sdeTblTgdEditor.StopEditing(true);

                        #region ----log
                        evt.Log = string.Format("\n----||| Đã lưu vị trí các thửa vào bảng {0} |||---- ", tgd);
                        onCalculating(evt);
                        #endregion

                        #endregion

                        #region tinh gia dat cho cac thua vua them vi tri
                        CalcLandprice calc = new CalcLandprice(this);
                        //MessageBox.Show(string.Format("final:{0}", newId.Count));
                        calc.Maduong = maduong;
                        calc.Calculate(newId);
                        newId.Clear();
                        #endregion
                        //============================

                    }
                    #endregion

                }
                #endregion
            }
            #endregion
            //=====================================================================
            //=====================================================================
            #region tinh theo duong,doan duong
            else
            {
                #region timduong co ten dang xet
                //tinh theo doan duong
                #region tinh theo doan duong
                if (_inputParams.MA_DUONG != "-1")
                {
                    qrf.WhereClause = string.Format("{0}={1}", _fcName.FC_DUONG.MA_DUONG, _inputParams.MA_DUONG);// "maduong='2'";

                    #region ----log
                    evt.Log = string.Format("\n************************************************");
                    evt.Log += string.Format("\n******   Đang tính cho đoạn đường có mã: {0}  ******", _inputParams.MA_DUONG);
                    evt.Log += string.Format("\n************************************************");
                    onCalculating(evt);
                    #endregion
                }
                #endregion
                //tinh cho 1 duong
                #region tinh cho 1 duong
                else if (_inputParams.TEN_DUONG != "" && _inputParams.TEN_DUONG != "*")
                {
                    //phai sua lai thiet ke
                    //dung relationshipclass many to many gia duong va ten duong
                    #region tim trong bang ten duong
                    qrf.WhereClause = string.Format("{0}=N'{1}'", _tblName.TEN_DUONG.TEN_DUONG, _inputParams.TEN_DUONG);
                    //MessageBox.Show(string.Format("line 908 CalPosThuaNnVt1, tenduong={0}", _inputParams.TEN_DUONG));
                    ICursor tenduongCur = tblTenDuong.Search(qrf, false);
                    object idDuong;
                    List<object> lstIdDuong=new List<object>();
                    try
                    {
                        IRow tenduongRow = null;
                        while ((tenduongRow = tenduongCur.NextRow()) != null)
                        {
                            idDuong = tenduongRow.get_Value(tenduongRow.Fields.FindField(_tblName.TEN_DUONG.MA_DUONG));
                            lstIdDuong.Add(idDuong);
                        }
                    }
                    catch
                    { }
                    finally{Marshal.ReleaseComObject(tenduongCur);}
                    #endregion

                    #region tim trong bang duong
                    string q = "";
                    for (int i = 0; i < lstIdDuong.Count; i++)
                    {
                        if (i == lstIdDuong.Count - 1)
                        {
                            q +=string.Format("{0}='{1}'",_fcName.FC_DUONG.MA_DUONG,lstIdDuong[i]);
                        }
                        else
                        {
                            q += string.Format("{0}='{1}' or ", _fcName.FC_DUONG.MA_DUONG, lstIdDuong[i]);
                        }
                    }
                        qrf.WhereClause = q;// "maduong='2'";

                    #region ----log
                    evt.Log = string.Format("\n************************************************");
                    evt.Log += string.Format("\n******   Đang tính cho cả đường: {0}  ******", _inputParams.TEN_DUONG);
                    evt.Log += string.Format("\n************************************************");
                    onCalculating(evt);
                    #endregion
                    #endregion
                }
                #endregion
                //tinh cho ca duong
                else
                {
                    qrf.WhereClause = "";
                }
                //MessageBox.Show(string.Format("whereclause:{0}",duong.QueryFilter.WhereClause));
                ISelectionSet duongSelectionSet = duongFeatureClass.Select(qrf, esriSelectionType.esriSelectionTypeHybrid, esriSelectionOption.esriSelectionOptionNormal, sdeConn.Workspace);

                if (duongSelectionSet.Count == 0)
                {
                    return;
                }
                duongFeatureSelection = (IFeatureSelection)duongFeatureLayer;
                duongFeatureSelection.SelectionSet = duongSelectionSet;

                #endregion

                #region vong lap xet tung duong

                //[thaydoi] - co the them bien chay
                //===============================
                #region khoi dau
                IEnumIDs eIds = duongSelectionSet.IDs;
                int duongId;
                IFeature ftDuong;
                int iDuong = 0;
                int progressingTotalCount = 1;
                evt.Reset();
                evt.ProgressingTotal = duongSelectionSet.Count;
                onCalculating(evt);
                List<object> lstMaDuong = new List<object>();
                #endregion
                //================================

                while ((duongId = eIds.Next()) != -1)
                {
                    //[kodoi]
                    //======================
                    #region log-----
                    evt.Reset();
                    evt.ProgressingTotalCount = progressingTotalCount;
                    onCalculating(evt);
                    progressingTotalCount++;
                    #endregion
                    //======================

                    //[capnhat] - lay ten duong tu bang ten duong
                    //++++++++++++++++++++++++
                    #region lay thong tin cua duong dang xet

                    ftDuong = duongFeatureClass.GetFeature(duongId);
                    double dorongDuong;
                    result = double.TryParse(ftDuong.get_Value(_fcName.FC_DUONG.GetIndex(_fcName.FC_DUONG.DO_RONG)).ToString(), out dorongDuong);
                    if (!result)
                    {
                        dorongDuong = 0;
                    }
                    if (dorongDuong < _currentConfig.DRongDuongVitri1Nn)
                    {
                        continue;
                    }
                    string tenduong = "";//ftDuong.get_Value(_fcName.FC_DUONG.GetIndex(_fcName.FC_DUONG.TEN_DUONG)).ToString();
                    object maduong = ftDuong.get_Value(_fcName.FC_DUONG.GetIndex(_fcName.FC_DUONG.MA_DUONG));
                    lstMaDuong.Add(maduong);
                    string batdau = "";// ftDuong.get_Value(_fcName.FC_DUONG.GetIndex(_fcName.FC_DUONG.BAT_DAU)).ToString();
                    string ketthuc = "";// ftDuong.get_Value(_fcName.FC_DUONG.GetIndex(_fcName.FC_DUONG.KET_THUC)).ToString();

                    #endregion
                    //++++++++++++++++++++++++

                    //[kodoi]
                    //Chon duong dang xet, buoc này de ra layer duong dung de truy van khong gian cac thua dat
                    //====================
                    #region chon duong dang xet
                    qrf.WhereClause = string.Format("{0}='{1}'", _fcName.FC_DUONG.OID, duongId);
                    duongSelectionSet = duongFeatureClass.Select(qrf, esriSelectionType.esriSelectionTypeHybrid, esriSelectionOption.esriSelectionOptionOnlyOne, sdeConn.Workspace);
                    duongFeatureSelection = (IFeatureSelection)duongFeatureLayer;

                    duongFeatureSelection.SelectionSet = duongSelectionSet;
                    #endregion
                    //====================

                    //tim cac thua theo dieu kien mat tien
                    #region tinh vi tri cho cac thua
                    //doc cach tim thua trong bang he so vi tri
                    //lay cach tim cho dat o
                    //truyen thong so cach tinh,thualayer,duonglayer,khoangcach

                    //MessageBox.Show(func);
                    //func = "ChongLop([INTERSECT],[NEW_SELECTION],1) Then ChongLop([CONTAINED_BY],[AND_SELECTION],50)";

                    //[kodoi]
                    //============================
                    #region tim cac thua theo vi tri quy dinh
                    thuaFeatureSelection = (IFeatureSelection)thuaFeatureLayer;
                    thuaFeatureSelection.Clear();
                    Evaluation eval = new Evaluation(quytac);
                    eval.ThuaLayer = thuaFeatureLayer;
                    eval.DuongLayer = duongFeatureLayer;
                    eval.EvaluateQuery();
                    //thuaFeatureSelection = (IFeatureSelection)thuaFeatureLayer;
                    ISelectionSet thuaSelectionSet = thuaFeatureSelection.SelectionSet;
                    #endregion
                    //============================

                    //MessageBox.Show(thuaSelectionSet.Count.ToString());
                    #endregion

                    #region clip cac thua vua tim duoc

                    #region delete bang thua_sau100m_clip
                    IFeatureClass thuaClipFc = null;
                    #region log---
                    evt.Log = string.Format("\n----Kiểm tra, xóa bảng {0} ...", thuaClip100mCoSde);
                    onCalculating(evt);
                    #endregion

                    if (_dataManager.LayerExist(thuaClip100mNoSde))
                    {
                        //thuaClipFc = fw.OpenFeatureClass("sde.thua_sau50m_clip");
                        //mwspEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMVersioned);
                        //wspEdit.StartEditing(false);
                        //wspEdit.StartEditOperation();
                        ((IFeatureClassManager)_dataManager).DeleteFcInSde(thuaClip100mCoSde);
                        //((IDataset)thuaClipFc).Delete();
                        //wspEdit.StopEditOperation();
                        //wspEdit.StopEditing(true);
                    }
                    #endregion

                    #region chon duong buffer 100 dang xet
                    qrf.WhereClause = string.Format("{0}='{1}'", _fcName.FC_DUONG.OID, duongId);
                    duongBuff100Sls = duongBuff100FeatureClass.Select(qrf, esriSelectionType.esriSelectionTypeHybrid, esriSelectionOption.esriSelectionOptionOnlyOne, sdeConn.Workspace);
                    duongBuff100Fsls = (IFeatureSelection)duongBuff100FeatureLayer;
                    duongBuff100Fsls.SelectionSet = duongBuff100Sls;
                    #endregion

                    #region log---
                    evt.Log = string.Format("\n----Kiểm tra, clip thửa theo đường buffer {0}m, lưu vào bảng {1} ...", _currentConfig.DSauDuongVitri1Nn, thuaClip100mCoSde);
                    onCalculating(evt);
                    #endregion

                    string thualyr = string.Format("{0}/{1}", _sysTempPath.TempPath, thuaClip100mNoSde);
                    string duonglyr = string.Format("{0}/{1}", _sysTempPath.TempPath, duongBuffer100mNoSde);
                    _clipTool.ClipByLayerFileInsideSde(thuaFeatureLayer, thualyr, duongBuff100FeatureLayer, duonglyr, thuaClip100mNoSde);
                    try
                    {
                        thuaClipFc = fw.OpenFeatureClass(thuaClip100mCoSde);
                    }
                    catch (Exception ex) { continue; }
                    _version.RegisterDataset((IDataset)thuaClipFc, true, true);
                    #endregion

                    //[kodoi]
                    //============================
                    #region ----log
                    if (thuaSelectionSet.Count == 0)
                    {
                        evt.Log = string.Format("\n !!! Không tìm thấy thửa nào tiếp giáp với đường {0} đoạn từ {1} đến {2} và nằm trong vùng buffer 50m", tenduong, batdau, ketthuc);
                        onCalculating(evt);

                        #region report progressing duong
                        if (iDuong < duongSelectionSet.Count)
                        {
                            decimal i = (decimal)iDuong % (decimal)duongSelectionSet.Count * 100;
                            int i1 = Convert.ToInt32(i);
                            this._bgwCalculating.ReportProgress(i1);
                            //MessageBox.Show("log 009");
                        }
                        else
                        {
                            this._bgwCalculating.ReportProgress(99);
                        }
                        iDuong++;
                        #endregion

                        continue;
                    }
                    #endregion
                    sothuatimthay += thuaSelectionSet.Count;
                    //============================

                    #region xet tung thua

                    //[thaydoi] - co the them bien chay
                    //********************
                    #region khoi dau
                    IEnumIDs thuaIds = thuaSelectionSet.IDs;
                    int thuaId;
                    IFeature thuaFt;
                    int iThua = 0;
                    List<object[,]> pairColValTgd = new List<object[,]>();
                    int rowTgdNnHandleUpdate = 0;
                    List<object> newId = new List<object>();
                    #endregion
                    //********************

                    while ((thuaId = thuaIds.Next()) != -1)
                    {
                        int hesoVitri = TnHeSoK.DatNongNghiepVt1Hon100m;

                        //[thaydoi] - co them them dieu kien de xac dinh vi tri cua thua
                        //***********************************
                        #region lay thong tin thua dang xet

                        //[kodoi]
                        //============================
                        #region lay thong tin co ban
                        thuaFt = thuaFeatureClass.GetFeature(thuaId);
                        //neu thua bi khoa tim vi tri,bo qua,xet thua ke
                        string lockTimVitri = thuaFt.get_Value(thuaFt.Fields.FindField(_fcName.FC_THUA.LOCKED)).ToString();
                        if (lockTimVitri == "1")
                        {
                            sothuaKhongTinhDuoc++;

                            #region report progressing thua
                            if (iThua < thuaSelectionSet.Count)
                            {
                                decimal i = (decimal)iThua / (decimal)thuaSelectionSet.Count * 100;
                                int i1 = Convert.ToInt32(i);
                                this._bgwCalculating.ReportProgress(i1);
                                //MessageBox.Show("log 009");
                            }
                            else
                            {
                                this._bgwCalculating.ReportProgress(99);
                            }
                            iThua++;
                            #endregion

                            continue;

                        }
                        //neu thua ko thuoc xa dang xet thi ko tinh tiep
                        object mathua = thuaFt.get_Value(thuaFt.Fields.FindField(_fcName.FC_THUA.MA_THUA));
                        object maxaThua = thuaFt.get_Value(thuaFt.Fields.FindField(_fcName.FC_THUA.MA_XA));
                        object dientichpl = thuaFt.get_Value(thuaFt.Fields.FindField(_fcName.FC_THUA.DIEN_TICH));
                        #endregion
                        //============================

                        //[kodoi]
                        //============================
                        #region kiem tra maxa
                        if (maxaThua.ToString() == "" || maxaThua==null)
                        {
                            maxaThua = "0";

                            #region ----log
                            evt.Log = string.Format("Chưa xác định mã xã cho thửa {0}", mathua);
                            #endregion

                            sothuaKhongTinhDuoc++;

                            #region report progressing thua
                            if (iThua < thuaSelectionSet.Count)
                            {
                                decimal i = (decimal)iThua / (decimal)thuaSelectionSet.Count * 100;
                                int i1 = Convert.ToInt32(i);
                                this._bgwCalculating.ReportProgress(i1);
                                //MessageBox.Show("log 009");
                            }
                            else
                            {
                                this._bgwCalculating.ReportProgress(99);
                            }
                            iThua++;
                            #endregion

                            continue;
                        }
                        #endregion
                        //============================

                        #region lay loai dat

                        //neu ko co dat phi nong nghiep thi bo qua,xet thua ke
                        //neu co dat nong nghiep thi datnn=true
                        //neu la dat hon hop, neu co dat sxkd thi datsxkd=true,
                        //neu co dat o thi codato=true
                        //cac truong hop he so vi tri:
                        //o:3010, sxkd:4010, o+nn:5010, o+sxkd:6010
                        string loaidat = thuaFt.get_Value(thuaFt.Fields.FindField(_fcName.FC_THUA.LOAI_DAT)).ToString();
                        //evt.Log = string.Format("\n loai dat cua thua {0} la {1}", thuaId, loaidat);
                        //onCalculating(evt);

                        //[thaydoi] - may tinh dat nong nghiep co the khac
                        //***********************
                        #region kiem tra dat nong nghiep
                        bool codatnn = false;
                        object datnn="";
                        foreach (string s in TnLoaiDats.NONG_NGHIEP)
                        {
                            if (loaidat==s)
                            {
                                codatnn = true;
                                datnn = s;
                                break;
                            }
                            else
                            {
                                codatnn = false;
                            }
                        }
                        if (!codatnn)
                        {
                            sothuaKhongTinhDuoc++;

                            #region report progressing thua
                            if (iThua < thuaSelectionSet.Count)
                            {
                                decimal i = (decimal)iThua / (decimal)thuaSelectionSet.Count * 100;
                                int i1 = Convert.ToInt32(i);
                                this._bgwCalculating.ReportProgress(i1);
                                //MessageBox.Show("log 009");
                            }
                            else
                            {
                                this._bgwCalculating.ReportProgress(99);
                            }
                            iThua++;
                            #endregion

                            continue;
                        }
                        #endregion
                        //***********************

                        #endregion

                        #endregion
                        //***********************************

                        //[thaydoi] - thay doi he so vi tri phu hop
                        //***********************************
                        #region quyet dinh he so vi tri cho thua
                        if (codatnn)
                        {
                            hesoVitri = TnHeSoK.DatNongNghiepVt1Hon100m;
                        }
                        else
                        {
                            hesoVitri = TnHeSoK.KhongXacDinh;
                        }
                        #endregion
                        //***********************************

                        //[thaydoi] - thay doi dieu kien truy van ung voi tung may tinh khac nhau
                        //***********************************
                        #region kiem tra trong bang thua_giadat, voi dieu kien:mathua,maduong,hesovitri,khoagia=0
                        evt.Reset();
                        evt.Log = string.Format("\n[!]--- Kiểm tra các vị trí, cập nhật vị trí mới cho thửa {0} ...", mathua);
                        onCalculating(evt);
                        qrf.WhereClause = string.Format("({0}='{1}' or {2} is null) and {3}='{4}' and {5}='{6}' and {7}='{8}'",
                            _fcName.FC_THUA_GIADAT_DRAFT.LOCKED, 0, _fcName.FC_THUA_GIADAT_DRAFT.LOCKED,
                            _fcName.FC_THUA_GIADAT_DRAFT.MA_THUA, mathua,
                            _fcName.FC_THUA_GIADAT_DRAFT.MA_DUONG, maduong,
                            _fcName.FC_THUA_GIADAT_DRAFT.HE_SO_K, hesoVitri);
                        ICursor tgdFcs = tblThuaGiaDat.Search(qrf, false);
                        IRow tgdRow = null;
                        //MessageBox.Show(string.Format("line 1401 CalcPosThuaMattien - bat dau try, query:\n{0}", qrf.WhereClause));
                        try
                        {
                            tgdRow = tgdFcs.NextRow();//dam bao la chi co 1 hang ket qua
                            if (tgdRow != null)
                            {
                                //MessageBox.Show("co");
                                //kiem tra co cho phep tinh lai vi tri
                                //neu co:xoa feater cu,them feature moi
                                #region xet thua da co vi tri

                                bool isOverWritePos = true;

                                if (!isOverWritePos)
                                {
                                    newId.Add(tgdRow.OID);
                                    //continue;
                                }
                                else
                                {
                                    //[kodoi]
                                    //===================
                                    #region xoa feature cu
                                    wspEdit.StartEditing(true);
                                    wspEdit.StartEditOperation();
                                    //qrf.WhereClause = string.Format("{0}='{1}'", "OBJECTID", tgdRow.OID);
                                    //tblThuaGiaDat.DeleteSearchedRows(qrf);
                                    tgdRow.Delete();
                                    wspEdit.StopEditOperation();
                                    wspEdit.StopEditing(true);
                                    #endregion
                                    //===================

                                    #region chon trong bang thua clip
                                    qrf.WhereClause = string.Format("{0}='{1}'", _fcName.FC_THUA.MA_THUA, mathua);
                                    IFeatureCursor thuaClipFcur = thuaClipFc.Search(qrf, false);
                                    IFeature thuaClipFt = null;
                                    try
                                    {
                                        thuaClipFt = thuaClipFcur.NextFeature();
                                        if (thuaClipFt == null)
                                        {
                                            continue;
                                        }
                                    }
                                    catch (Exception ex) { continue; }
                                    finally { Marshal.ReleaseComObject(thuaClipFcur); }

                                    #region lay thong tin thua clip
                                    IArea area = (IArea)thuaClipFt.Shape;
                                    #endregion

                                    #endregion

                                    //[thaydoi] - them gia tri
                                    //**********************
                                    #region them feature moi
                                    object copiedId = null;
                                    try
                                    {
                                        mwspEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMVersioned);
                                        wspEdit.StartEditOperation();
                                        copiedId = copyTool.Copy(thuaClipFt, tgdFeatureClass);
                                        wspEdit.StopEditOperation();
                                        wspEdit.StopEditing(true);
                                    }
                                    catch (Exception ex)
                                    {
                                        wspEdit.AbortEditOperation();
                                        wspEdit.StopEditing(false);
                                    }

                                    //them gia tri mathua,maduong,hesovitri
                                    pairColValTgd.Add(new object[,] { { tgdRow.Fields.FindField(_fcName.FC_THUA_GIADAT_DRAFT.MA_THUA), mathua } });
                                    pairColValTgd.Add(new object[,] { { tgdRow.Fields.FindField(_fcName.FC_THUA_GIADAT_DRAFT.MA_DUONG), maduong } });
                                    pairColValTgd.Add(new object[,] { { tgdRow.Fields.FindField(_fcName.FC_THUA_GIADAT_DRAFT.HE_SO_K), hesoVitri } });
                                    pairColValTgd.Add(new object[,] { { _fcName.FC_THUA_GIADAT_DRAFT.GetIndex(_fcName.FC_THUA_GIADAT_DRAFT.DIEN_TICH_PHAP_LY), dientichpl } });
                                    sdeTblTgdEditor.CacheData(copiedId, rowTgdNnHandleUpdate, pairColValTgd, EnumTypeOfEdit.UPDATE);
                                    rowTgdNnHandleUpdate++;
                                    pairColValTgd.Clear();
                                    newId.Add(copiedId);
                                    #endregion
                                    //**********************
                                }

                                #endregion

                            }
                            else
                            {
                                #region chon trong bang thua clip
                                qrf.WhereClause = string.Format("{0}='{1}'", _fcName.FC_THUA.MA_THUA, mathua);
                                IFeatureCursor thuaClipFcur = thuaClipFc.Search(qrf, false);
                                IFeature thuaClipFt = null;
                                try
                                {
                                    thuaClipFt = thuaClipFcur.NextFeature();
                                    if (thuaClipFt == null)
                                    {
                                        continue;
                                    }
                                }
                                catch (Exception ex) { continue; }
                                finally { Marshal.ReleaseComObject(thuaClipFcur); }

                                #region lay thong tin thua clip
                                IArea area = (IArea)thuaClipFt.Shape;
                                #endregion

                                #endregion

                                //MessageBox.Show("ko co");
                                //[thaydoi] - them cac gia tri thich hop vao thua_giadat
                                //***********************************
                                #region them feature moi
                                object copiedId = null;
                                try
                                {
                                    mwspEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMVersioned);
                                    wspEdit.StartEditOperation();
                                    copiedId = copyTool.Copy(thuaClipFt, tgdFeatureClass);
                                    wspEdit.StopEditOperation();
                                    wspEdit.StopEditing(true);
                                }
                                catch (Exception ex)
                                {
                                    wspEdit.AbortEditOperation();
                                    wspEdit.StopEditing(true);
                                }

                                //them gia tri mathua,maduong,hesovitri
                                pairColValTgd.Add(new object[,] { { _fcName.FC_THUA_GIADAT_DRAFT.GetIndex(_fcName.FC_THUA_GIADAT_DRAFT.MA_THUA), mathua } });
                                pairColValTgd.Add(new object[,] { { _fcName.FC_THUA_GIADAT_DRAFT.GetIndex(_fcName.FC_THUA_GIADAT_DRAFT.MA_DUONG), maduong } });
                                pairColValTgd.Add(new object[,] { { _fcName.FC_THUA_GIADAT_DRAFT.GetIndex(_fcName.FC_THUA_GIADAT_DRAFT.HE_SO_K), hesoVitri } });
                                pairColValTgd.Add(new object[,] { { _fcName.FC_THUA_GIADAT_DRAFT.GetIndex(_fcName.FC_THUA_GIADAT_DRAFT.DIEN_TICH_PHAP_LY), dientichpl } });
                                sdeTblTgdEditor.CacheData(copiedId, rowTgdNnHandleUpdate, pairColValTgd, EnumTypeOfEdit.UPDATE);
                                rowTgdNnHandleUpdate++;
                                pairColValTgd.Clear();
                                newId.Add(copiedId);
                                #endregion
                                //***********************************
                            }
                            //MessageBox.Show(newId.Count.ToString());
                        }
                        catch (Exception e1) { MessageBox.Show(string.Format("CalcPosThuaMattien, line 1448-\n{0}", e1)); }
                        finally { Marshal.ReleaseComObject(tgdFcs); }
                        #endregion
                        //***********************************

                        #region report progressing thua
                        if (iThua < thuaSelectionSet.Count)
                        {
                            decimal i = (decimal)iThua / (decimal)thuaSelectionSet.Count * 100;
                            int i1 = Convert.ToInt32(i);
                            this._bgwCalculating.ReportProgress(i1);
                            //MessageBox.Show("log 009");
                        }
                        else
                        {
                            this._bgwCalculating.ReportProgress(99);
                        }
                        iThua++;
                        #endregion
                    }
                    #endregion

                    //[kodoi]
                    //============================
                    #region luu thong tin vao bang gia dat
                    if (!sdeTblTgdEditor.IsEditing())
                    {
                        sdeTblTgdEditor.StartEditing(true);
                        sdeTblTgdEditor.StartEditOperation();
                    }

                    #region ----log
                    evt.Log = string.Format("\n----||| Đang lưu vị trí các thửa vào bảng {0} |||---- ", tgd);
                    onCalculating(evt);
                    #endregion

                    sdeTblTgdEditor.SaveEdit();
                    sdeTblTgdEditor.StopEditOperation();
                    sdeTblTgdEditor.StopEditing(true);

                    #region ----log
                    evt.Log = string.Format("\n----||| Đã lưu vị trí các thửa vào bảng {0} |||---- ", tgd);
                    onCalculating(evt);
                    #endregion

                    #endregion

                    #region tinh gia dat cho cac thua vua them vi tri
                    CalcLandprice calc = new CalcLandprice(this);
                    //MessageBox.Show(string.Format("final:{0}", newId.Count));
                    calc.Maduong = maduong;
                    calc.Calculate(newId);
                    newId.Clear();
                    #endregion
                    //============================

                }
                #endregion
            }
            #endregion

            #endregion

            //===========================================
            //===========================================
            //*******************************************

            //[kodoi]
            //==============
            #region doan ket
            sothuatinhduoc = sothuatimthay - sothuaKhongTinhDuoc;

            #region ----log
            evt.Log = string.Format("\n\n**************************************\n******* Đã tính xong các thửa phi nông nghiệp tại đô thị vị trí mặt tiền*******\n**********************************");
            //evt.Log += string.Format("\n Số thửa tìm thấy: {0}", sothuatimthay);
            //evt.Log += string.Format("\n Số thửa được tính: {0}", sothuatinhduoc);
            onCalculating(evt);
            #endregion
            evt.Reset();
            evt.ProgressingTotalCount = ".";
            evt.ProgressingTotal = ".";
            onCalculating(evt);
            //evt.CurrentIndexCalculator=
            evt.CurrentIndexCalculator=this._index;
            onFinished(evt);
            #endregion
            //==============
        }
コード例 #35
0
 private void AssignScriptObjects(IClip clip)
 {
     m_Engine.Script["input"] = clip;
     m_Engine.Script["Script"] = new Script();
     m_Engine.Script["Gpu"] = Renderer.Dx9GpuInfo.Details;
     m_Engine.Script["__$xhost"] = new InternalHostFunctions();
     m_Engine.Script["Host"] = new Host();
 }
コード例 #36
0
 public ClipViewModel(IMetadataController controller, IClip clip)
     : base(controller, clip, GetType(clip), GetIcon(clip))
 {
 }
コード例 #37
0
 private static string GetType(IClip clip)
 {
     return clip.Duration > TimeSpan.FromMinutes(10) ? "VIDEO" : "CLIP";
 }
コード例 #38
0
ファイル: Track.cs プロジェクト: naik899/VideoMaker
 private void OnAddedClip(IClip clip)
 {
     if (_afterClipAdded != null)
     {
         _afterClipAdded(this, new AddedClipEventArgs(clip, this));
     }
 }