示例#1
0
        public void AddFormationObject(FormationInfo formation, ChartToShow chartToShow = null)
        {
            if (chartToShow == null)
                chartToShow = ChartManager.Instance.GetChartToShowObjectByID(formation.RefChart);
            if (chartToShow == null) throw new Exception("Chart to show object is null while adding formations");
            if (chartToShow.ChartObject == null) throw new Exception("Chart object is null while adding formations");

            if (!chartToShow.ChartObject.Formations.Any(u => u.ID == formation.ID))
                chartToShow.ChartObject.Formations.Add(formation);
            AddFormationToTrack(formation, chartToShow);
        }
示例#2
0
 private void AddChartToShowObject(Chart chart, IEnumerable<Chart> charts = null)
 {
     var chartToShow = GetChartToShowObjectByID(chart.ID, charts);
     if (chartToShow != null) return; //in case user tries to add  chart to show object twice
     var chartToShowObject = new ChartToShow
     {
         ChartObject = chart
     };
     if (charts == null)
         IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.Charts.Add(chartToShowObject);
     else
         GlobalDataModel.Instance.ChartToShowObjects.Add(chartToShowObject);
 }
示例#3
0
 private void AddFormationToTrack(FormationInfo formation, ChartToShow chartToShowObject)
 {
     foreach (var trackToShowObject in chartToShowObject.Tracks)            
         AddFormationInfoInTrackToShowObject(formation, trackToShowObject);            
 }
示例#4
0
        public void AddLithologyObject(LithologyInfo lithology, ChartToShow chartToShow = null, IEnumerable<Chart> charts = null)
        {
            if (chartToShow == null)
                chartToShow = IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.Charts.SingleOrDefault(u => u.ChartObject.ID == lithology.RefChart);

            if (chartToShow == null) return;

            var trackToShowObject = chartToShow.Tracks.SingleOrDefault(u => u.TrackObject.ID == lithology.RefTrack);
            if (trackToShowObject == null) return;

            if (trackToShowObject.TrackObject == null)
                throw new Exception("Track not found against track to show object while adding lithology");
            //while loading project track object would already have lithologies in it, so we dont have to re-add it in the object
            if (!trackToShowObject.TrackObject.Lithologies.Any(u => u.ID == lithology.ID))
                trackToShowObject.TrackObject.Lithologies.Add(lithology);
            FastLineRenderableSeries actualLithologySeries = null;

            //track to show object has renderable series  for lithologies
            //get the proper renderable series and add an annotation to it
            if (!trackToShowObject.CurveRenderableSeries.Any(u => (u as FastLineRenderableSeries).Name == "Lithology"))
            {
                AddLithologyAxisInChart(trackToShowObject, charts);
            }
            var normalDataSeries = new XyDataSeries<double, double>();
            var fullDataSeries = new XyDataSeries<double, double>();

            var renderableSeries = trackToShowObject.CurveRenderableSeries.Where(u => u.GetType() == typeof(FastLineRenderableSeries)).Select(v => v as FastLineRenderableSeries);
            actualLithologySeries = renderableSeries.SingleOrDefault(u => u.Name == "Lithology" && u.XAxisId == "Lithology");

            FastLineRenderableSeries normalLithologySeries = null;
            FastLineRenderableSeries fullLithologySeries = null;
            var subSeries = renderableSeries.Where(u => u.Tag != null && u.Tag.ToString() == lithology.LithologyName);
            if (!subSeries.Any())
            {
                normalLithologySeries = GetNormalLithologySeries(normalDataSeries, lithology.LithologyName);
                fullLithologySeries = GetFullLithologySeries(fullDataSeries, lithology.LithologyName, trackToShowObject);
                trackToShowObject.CurveRenderableSeries.Add(normalLithologySeries);
                trackToShowObject.CurveRenderableSeries.Add(fullLithologySeries);
                ApplyBindingToNormalLithology(actualLithologySeries, normalLithologySeries);
                ApplyBindingToFullLithology(actualLithologySeries, fullLithologySeries);

            }
            else
            {
                foreach (var series in subSeries)
                {
                    if (series.PointMarker.Width == 50)
                    {
                        normalLithologySeries = series;
                        normalDataSeries = normalLithologySeries.DataSeries as XyDataSeries<double, double>;
                    }
                    else
                    {
                        fullLithologySeries = series;
                        fullDataSeries = fullLithologySeries.DataSeries as XyDataSeries<double, double>;
                    }
                }
            }

            var startingPoint = int.Parse(lithology.InitialDepth.ToString());
            var endingPoint = int.Parse(lithology.FinalDepth.ToString());

            for (decimal i = startingPoint; i <= endingPoint; i++)
            {
                normalDataSeries.Append(9.5, double.Parse(i.ToString()));
                fullDataSeries.Append(5, double.Parse(i.ToString()));
            }
        }