コード例 #1
0
ファイル: DatasetManager.cs プロジェクト: nearcoding/GAP
 private static void AddCurvesByDataset(Dataset dataset)
 {
     foreach (var curveObject in dataset.Curves)
     {
         var requiredCharts = IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.Charts.Where(u => u.Tracks != null && u.ChartObject.ID == curveObject.RefChart);
         var requiredTracks = requiredCharts.SelectMany(u => u.Tracks.Where(v => v.TrackObject.ID == curveObject.RefTrack));
         foreach (var track in requiredTracks)
         {
             var curve = new Curve
             {                        
                 RefChart = curveObject.RefChart,
                 RefTrack = curveObject.RefTrack,
                 RefDataset = dataset.ID,
                 RefProject = dataset.RefProject,
                 RefWell = dataset.RefWell,
                 IsSeriesVisible = true
             };
             var trackObj = HelperMethods.Instance.GetTrackByID(curve.RefTrack);
             trackObj.Curves.ShouldUndoRedo = false;
             CurveManager.Instance.AddCurveObject(curve);
             ///trackObj.Curves.Add(curve);
             trackObj.Curves.ShouldUndoRedo = true;
         }
     }
 }
コード例 #2
0
ファイル: CurveManager.cs プロジェクト: nearcoding/GAP
        public void RemoveCurveObject(Curve curve, IEnumerable<Chart> charts=null)
        {
            var trackToShow = TrackManager.Instance.GetTrackToShowById(curve.RefTrack, charts);
            //we are returning at this point as there is a strong possibility that the removed curve is from another 
            //chart which does not track to show objects with it as they only belongs to selected  chart
            if (trackToShow == null)
            {
                var track = HelperMethods.Instance.GetTrackByID(curve.RefTrack, charts);
                if (track == null) throw new Exception("Track object is null");
                track.Curves.Remove(curve);
                return;
            }
            if (trackToShow.TrackObject == null) throw new Exception("Track object is null");

            var curveToShow = trackToShow.Curves.Where(u => u.CurveObject != null).Single(u => u.CurveObject.ID == curve.ID);
            trackToShow.Curves.Remove(curveToShow);

            var seriesToRemove = trackToShow.CurveRenderableSeries.SingleOrDefault(u => u.XAxisId == curve.ID);
            if (seriesToRemove != null)
            {
                var fastLineSeries = seriesToRemove as FastLineRenderableSeries;

                trackToShow.CurveRenderableSeries.Remove(seriesToRemove);
                trackToShow.XAxisCollection.Remove(trackToShow.XAxisCollection.Single(u => u.Id == curve.ID));
                trackToShow.TrackObject.Curves.Remove(curve);
                RemoveSubAnnotationsByCurve(trackToShow, curveToShow.CurveObject);
                GlobalDataModel.Instance.CheckForHasCurves(trackToShow);
            }
            if (curve.RefChart == IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.SelectedChart.ChartObject.ID)
                IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.CalculateMinMaxVisibleRangeLimitForYAxis();
        }
コード例 #3
0
ファイル: CurveManager.cs プロジェクト: nearcoding/GAP
        private void AddCurveToShowObject(Curve curve, IEnumerable<Chart> charts = null)
        {
            var trackToShow = TrackManager.Instance.GetTrackToShowById(curve.RefTrack, charts);
            //we are returning at this point as there is a strong possibility that the removed curve is from another 
            //chart which does not track to show objects with it as they only belongs to selected  chart
            if (trackToShow == null) return;// throw new Exception("Track to show object not found");

            var curveToShowByID = GetCurveToShowById(curve.ID, charts);
            if (curveToShowByID != null) return;
            AddCurveToShowToTrackToShow(trackToShow, curve, charts);
        }
コード例 #4
0
ファイル: CurveManager.cs プロジェクト: nearcoding/GAP
        public void AddCurveObject(Curve curve, IEnumerable<Chart> charts = null)
        {
            var track = HelperMethods.Instance.GetTrackByID(curve.RefTrack, charts);
            if (track == null) throw new Exception("Track not found where curve is supposed to insert");

            var curveObject = HelperMethods.Instance.GetCurveById(curve.ID, charts);
            if (curveObject == null)
            {
                curveObject = HelperMethods.Instance.GetAllCurves(charts, true).SingleOrDefault(u => u.RefChart == curve.RefChart && u.RefTrack == curve.RefTrack && u.RefDataset == curve.RefDataset);
                if (curveObject == null)
                    track.Curves.Add(curve);
            }
            if (charts != null || IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.SelectedChart.ChartObject.ID == curve.RefChart)
                AddCurveToShowObject(curve, charts);
        }
コード例 #5
0
ファイル: CurveManager.cs プロジェクト: nearcoding/GAP
        private void RemoveSubAnnotationsByCurve(TrackToShow trackToShow, Curve curve)
        {
            var lineAnnotations = trackToShow.Annotations.Where(u => u.GetType() == typeof(LineAnnotationExtended)).Select(v => v as LineAnnotationExtended);
            lineAnnotations = lineAnnotations.Where(u => u.CurveToShow != null && u.CurveToShow.CurveObject.ID == curve.ID);

            foreach (var annotation in lineAnnotations.ToList())
            {
                trackToShow.Annotations.Remove(annotation);
            }
        }
コード例 #6
0
ファイル: CurveManager.cs プロジェクト: nearcoding/GAP
 /// <summary>
 /// this information is helpful while getting information about curves while restoring a dataset in undo redo process
 /// </summary>
 /// <param name="curve"></param>
 /// <param name="dataset"></param>
 private static void AddCurveInformationInDataset(Curve curve, Dataset dataset)
 {
     if (!dataset.Curves.Any(u => u.RefChart == curve.RefChart && u.RefTrack == curve.RefTrack))
     {
         dataset.Curves.Add(new DatasetCurveInfo
         {
             RefChart = curve.RefChart,
             RefTrack = curve.RefTrack
         });
     }
 }
コード例 #7
0
ファイル: CurveManager.cs プロジェクト: nearcoding/GAP
        public void AddCurveToShowToTrackToShow(TrackToShow trackToShow, Curve curve, IEnumerable<Chart> charts = null)
        {
            var dataset = HelperMethods.Instance.GetDatasetByID(curve.RefDataset);
            if (dataset == null) return;

            if (charts == null)
                AddCurveInformationInDataset(curve, dataset);

            var curveToShow = new CurveToShow(trackToShow.TrackObject.RefChart, trackToShow.TrackObject.ID, dataset.ID)
                {
                    CurveObject = curve,
                    TrackToShowObject = trackToShow,
                    IsSeriesVisible = curve.IsSeriesVisible
                };
            if (charts == null)
                AddExistingSubDatasetToTrack(trackToShow, dataset, curveToShow);

            GlobalDataModel.Instance.StylingOfScaleControl(dataset, curveToShow); 
            
            var xAxis = GetNewXAxisAndSetVisibleRangeLimit(dataset);

            xAxis.Id = curveToShow.CurveObject.ID;
            trackToShow.XAxisCollection.Add(xAxis);

            curveToShow.AnnotationModifier.XAxisId = xAxis.Id;

             var fastLineSeries = GlobalDataModel.Instance.AddDataseriesInformationToCurve(dataset, curveToShow);

            BindCurveProperties(fastLineSeries, curveToShow);

            trackToShow.HasCurves = trackToShow.CurveRenderableSeries.Any();

            IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.CalculateMinMaxVisibleRangeLimitForYAxis();

            trackToShow.Curves.Add(curveToShow);
            curveToShow.IsSeriesVisible = curve.IsSeriesVisible;
        }
コード例 #8
0
		static void CurveList_BeforeItemDelete(Curve objectToBeDeleted)
		{
			DeletedCurve = objectToBeDeleted;
		}