/// <summary> /// this method binds the subdataset annotation visibility with the curve to show IsSeries visible property, /// so upon checking visibility for curve, it should hide the annotations as well /// </summary> /// <param name="lineAnnotation"></param> public void LineAnnotationExtendedBinding(LineAnnotationExtended lineAnnotation) { lineAnnotation.SetBinding(LineAnnotationExtended.IsHiddenProperty, new Binding("IsSeriesVisible") { Source = this, Converter = new InverseBooleanConverter() }); lineAnnotation.SetBinding(LineAnnotationExtended.StrokeProperty, new Binding("LineColor") { Source = lineAnnotation.SubDataset, Converter = new ColourToBrushConverter() }); lineAnnotation.SetBinding(LineAnnotationExtended.StrokeThicknessProperty, new Binding("LineGrossor") { Source = lineAnnotation.SubDataset, Converter = new LineGrossorToStrokeThicknessConverter() }); lineAnnotation.SetBinding(LineAnnotationExtended.StrokeDashArrayProperty, new Binding("LineStyle") { Source = lineAnnotation.SubDataset, Converter = new SubDatasetLineStyleToStrokeDashArrayConverter() }); }
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 AddFormationBinding(LineAnnotationExtended annotation) { annotation.SetBinding(LineAnnotationExtended.IsHiddenProperty, new Binding("IsFormationVisible") { Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Source = IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.GeologyMenu, Converter = new InverseBooleanConverter() }); }
private LineAnnotationExtended ReplaceLineAnnotationWithLineAnnotationExtended() { var lineAnnotation = TrackToShowObject.Annotations[TrackToShowObject.Annotations.Count - 1]; var lineAnnotationExtended = new LineAnnotationExtended { SubDataset = CurrentSubDataset, CurveToShow = this, X1 = lineAnnotation.X1, X2 = lineAnnotation.X2, Y1 = lineAnnotation.Y1, Y2 = lineAnnotation.Y2, XAxisId = this.CurveObject.ID, Id = Guid.NewGuid().ToString() }; TrackToShowObject.Annotations.Remove(lineAnnotation); TrackToShowObject.Annotations.Add(lineAnnotationExtended); return lineAnnotationExtended; }
public void AddAnnotation(LineAnnotationExtended lineAnnotation) { var lineAnnotations = TrackToShowObject.Annotations.Where(u => u.GetType() == typeof(LineAnnotationExtended)).Select(v => v as LineAnnotationExtended); if (lineAnnotations.Any(u => u.Id == lineAnnotation.Id)) { throw new Exception("Duplication line annotation is about th enter in the system"); } TrackToShowObject.Annotations.Add(lineAnnotation); }