public void AddLithologiesToTrack(TrackToShow track) { var renderableSeries = track.CurveRenderableSeries.Where(u => u.GetType() == typeof(FastLineRenderableSeries)).Select(v => v as FastLineRenderableSeries); FastLineRenderableSeries actualLithologySeries = null; actualLithologySeries = renderableSeries.SingleOrDefault(u => u.Name == "Lithology" && u.XAxisId == "Lithology"); if (actualLithologySeries == null) { LithologyManager.Instance.AddLithologyAxisInChart(track); actualLithologySeries = renderableSeries.SingleOrDefault(u => u.Name == "Lithology" && u.XAxisId == "Lithology"); } var lst = track.TrackObject.Lithologies; actualLithologySeries.IsVisible = true; var grouped = lst.GroupBy(u => u.LithologyName).ToList(); var seriesCollection = new ObservableCollection<FastLineRenderableSeries>(); var trackObject = track.TrackObject; var curveToShowObject = track.Curves.SingleOrDefault(u => u.RefChart == trackObject.RefChart && u.RefTrack == trackObject.ID && u.RefDataset == "Lithology"); foreach (var obj in grouped) { var dataSeries = new XyDataSeries<double, double>(); var fullDataSeries = new XyDataSeries<double, double>(); string imageName = obj.Key; FastLineRenderableSeries normalLithologySeries = GetNormalLithologySeries(dataSeries, imageName); FastLineRenderableSeries fullLithologySeries = GetFullLithologySeries(fullDataSeries, imageName, track); ApplyBindingToNormalLithology(actualLithologySeries, normalLithologySeries); ApplyBindingToFullLithology(actualLithologySeries, fullLithologySeries); seriesCollection.Add(normalLithologySeries); seriesCollection.Add(fullLithologySeries); foreach (var item in obj) { decimal initialDepth = item.InitialDepth; decimal finalDepth = item.FinalDepth; for (decimal i = initialDepth; i <= finalDepth; i++) { dataSeries.Append(9.5, double.Parse(i.ToString())); fullDataSeries.Append(5, double.Parse(i.ToString())); } } if (curveToShowObject != null) actualLithologySeries.IsVisible = curveToShowObject.IsSeriesVisible; } foreach (var series in seriesCollection) track.CurveRenderableSeries.Add(series); }
public void AddFormationInfoInTrackToShowObject(FormationInfo formation, TrackToShow trackToShowObject) { if (!trackToShowObject.CurveRenderableSeries.Any(u => (u as FastLineRenderableSeries).Name == "Formation")) AddFormationAxisInChart(trackToShowObject); if (trackToShowObject.FormationsList.Any(u => u.ID == formation.ID)) return; var renderableSeries = trackToShowObject.CurveRenderableSeries.Single(u => (u as FastLineRenderableSeries).Name == "Formation"); var startingPoint = double.Parse(formation.Depth.ToString()); var lineAnnotations = trackToShowObject.Annotations.Where(u => u.GetType() == typeof(LineAnnotationExtended)).Select(v => v as LineAnnotationExtended); var annotation = new LineAnnotationExtended { X1 = 0, X2 = 1, Y1 = startingPoint, Y2 = startingPoint, Visibility = Visibility.Visible, Stroke = new SolidColorBrush(formation.FormationColor), CoordinateMode = AnnotationCoordinateMode.RelativeX, Tag = formation.FormationName }; trackToShowObject.FormationsList.Add(formation); string toolTipString = IoC.Kernel.Get<IResourceHelper>().ReadResource("FormationTooltip"); toolTipString = toolTipString.Replace(@"\n", Environment.NewLine); GlobalDataModel.ApplyStyleToLine(annotation, formation.LineStyle); GlobalDataModel.ApplyGrossStyleToLine(annotation, formation.LineGrossor); annotation.ToolTip = string.Format(toolTipString, annotation.Y1.ToString(), formation.FormationName); annotation.SetValue(ToolTipService.IsEnabledProperty, IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.GeologyMenu.IsFTTooltipVisible.Value); AddFormationBinding(annotation); var series = renderableSeries.DataSeries as XyDataSeries<double, double>; series.Append(0, startingPoint); annotation.XAxisId = "Formation"; trackToShowObject.Annotations.Add(annotation); AddNameFormation(formation, trackToShowObject); }
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); } }
public void AddExistingSubDatasetToTrack(TrackToShow trackToShow, Dataset dataset, CurveToShow curveToShow) { if (dataset.SubDatasets.Any()) { foreach (var subdataset in dataset.SubDatasets) { curveToShow.SubDatasets.Add(subdataset); foreach (var annotation in subdataset.Annotations) { var lineAnnotation = HelperMethods.Instance.GetLineAnnotationByAnnotationInfoAndSubDataset(annotation, subdataset, curveToShow); curveToShow.LineAnnotationExtendedBinding(lineAnnotation); lineAnnotation.Id = annotation.ID; trackToShow.Annotations.Add(lineAnnotation); } } } }
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; }
private void AddNameFormation(FormationInfo formation, TrackToShow trackToShow) { var annotationText = formation.FormationName.Length > 20 ? formation.FormationName.Substring(0, 20) : formation.FormationName; var textAnnotation = new CustomAnnotation { Content = annotationText, X1 = 0, X2 = 1, Y1 = double.Parse(formation.Depth.ToString()), Y2 = double.Parse(formation.Depth.ToString()), FontFamily = new FontFamily("Arial"), FontSize = 12, Height = 30, HorizontalAlignment = HorizontalAlignment.Right, HorizontalContentAlignment = HorizontalAlignment.Right, Padding = new Thickness(0, -20, 25, 0), CoordinateMode = AnnotationCoordinateMode.RelativeX, Tag = "Formation" }; textAnnotation.XAxisId = "Formation"; Binding binding = new Binding("Width") { Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Source = trackToShow.TrackObject }; textAnnotation.SetBinding(CustomAnnotation.WidthProperty, binding); AddFTNameBinding(textAnnotation); trackToShow.Annotations.Add(textAnnotation); }
private void AddFormationAxisInChart(TrackToShow trackToShowObject) { GlobalDataModel.Instance.AddNamedAxisInChart(trackToShowObject, "Formation"); }
private static FastLineRenderableSeries GetFullLithologySeries(XyDataSeries<double, double> dataSeries, string imageName, TrackToShow track) { var marker = new LithologyMarker(imageName) { Fill = Colors.Red, Stroke = Colors.Green }; FastLineRenderableSeries series = new FastLineRenderableSeries { Tag = imageName, DataSeries = dataSeries, XAxisId = "Lithology", ResamplingMode = ResamplingMode.None, PointMarker = marker }; BindingOperations.SetBinding(marker, LithologyMarker.WidthProperty, new Binding("Width") { Source = track.TrackObject }); return series; }
private void RemoveDataSeriesForLithology(TrackToShow trackToShow, LithologyInfo lithology) { //all lithology series on the track var renderableSeries = trackToShow.CurveRenderableSeries.Where(u => u.XAxisId == "Lithology" && u.GetType() == typeof(FastLineRenderableSeries)).Select(v => v as FastLineRenderableSeries); renderableSeries = renderableSeries.Where(u => u.Tag != null && u.Tag.ToString() == lithology.LithologyName); //var renderableSeries = trackToShow.CurveRenderableSeries.SingleOrDefault(u => (u as FastLineRenderableSeries).Name == "Lithology"); if (renderableSeries != null) { //there should be two series with this information one is normal and other is full lithology foreach (var series in renderableSeries) { //get all lithologies object from the track which are lower than current object's initial depth var lithologies = trackToShow.TrackObject.Lithologies.Where(u => u.LithologyName == lithology.LithologyName && u.InitialDepth < lithology.InitialDepth); int indexToSkip = 0; foreach (var obj in lithologies) { indexToSkip = indexToSkip + 1 + Int32.Parse((obj.FinalDepth - obj.InitialDepth).ToString()); } var dataSeries = series.DataSeries as XyDataSeries<double, double>; int count = Int32.Parse(((lithology.FinalDepth + 1) - lithology.InitialDepth).ToString()); dataSeries.RemoveRange(indexToSkip, count); } } }
public void AddLithologyAxisInChart(TrackToShow trackToShowObject, IEnumerable<Chart> charts = null) { TrackManager.Instance.AddLithologyCurveToTrack(trackToShowObject, charts); GlobalDataModel.Instance.AddNamedAxisInChart(trackToShowObject, "Lithology"); if (IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.GeologyMenu.IsLithologyVisible || IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.GeologyMenu.IsFullLithology) if (trackToShowObject.TrackObject.Lithologies.Any()) trackToShowObject.HasCurves = trackToShowObject.Curves.Any(); }
public SurfaceTestWindow(TrackToShow trackObject) { InitializeComponent(); DataContext = trackObject; }