diff --git a/Application/AnnotationPlane/ColumnSettings/ColumnDefinitionView.xaml b/Application/AnnotationPlane/ColumnSettings/ColumnDefinitionView.xaml
index 51902ac..87fc38f 100644
--- a/Application/AnnotationPlane/ColumnSettings/ColumnDefinitionView.xaml
+++ b/Application/AnnotationPlane/ColumnSettings/ColumnDefinitionView.xaml
@@ -37,10 +37,10 @@
-
-
-
-
+
+
+
+
-
-
diff --git a/Application/AnnotationPlane/ColumnSettings/ColumnSettingsView.xaml b/Application/AnnotationPlane/ColumnSettings/ColumnSettingsView.xaml
index 5510655..2756334 100644
--- a/Application/AnnotationPlane/ColumnSettings/ColumnSettingsView.xaml
+++ b/Application/AnnotationPlane/ColumnSettings/ColumnSettingsView.xaml
@@ -12,17 +12,32 @@
-
-
-
-
-
-
-
-
-
-
- Добавить колонку:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Добавить колонку:
Шкала глубин
Фото
@@ -34,14 +49,7 @@
Значки
-
-
-
-
-
-
-
-
+
diff --git a/Application/AnnotationPlane/ColumnSettings/VisualColumnDefinitionView.xaml b/Application/AnnotationPlane/ColumnSettings/VisualColumnDefinitionView.xaml
index 399a991..eb883d2 100644
--- a/Application/AnnotationPlane/ColumnSettings/VisualColumnDefinitionView.xaml
+++ b/Application/AnnotationPlane/ColumnSettings/VisualColumnDefinitionView.xaml
@@ -4,40 +4,43 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:CoreSampleAnnotation.AnnotationPlane.ColumnSettings"
- mc:Ignorable="d"
- d:DesignHeight="300" d:DesignWidth="300">
-
- Крап
-
-
-
-
-
-
-
- Ширина
-
-
-
-
-
-
-
- Правая граница
-
-
-
-
-
-
-
- Нижняя граница
-
-
-
-
-
-
-
+ mc:Ignorable="d">
+
+
+ Крап
+
+
+
+
+
+
+
+ Ширина
+
+
+
+
+
+
+
+
+
+ Правая граница
+
+
+
+
+
+
+
+ Нижняя граница
+
+
+
+
+
+
+
+
diff --git a/Application/AnnotationPlane/Columns/Drawing.cs b/Application/AnnotationPlane/Columns/Drawing.cs
index a7d29cc..aeb2f94 100644
--- a/Application/AnnotationPlane/Columns/Drawing.cs
+++ b/Application/AnnotationPlane/Columns/Drawing.cs
@@ -20,12 +20,12 @@ public static IEnumerable GetRightPolyline(double width, double height, I
return result;
}
- public static IEnumerable GetBottomPolyline(double width, double height, ISideCurveGenerator bottomSideCurve)
+ public static IEnumerable GetBottomPolyline(double xOffset, double width, double height, ISideCurveGenerator bottomSideCurve)
{
List result = new List();
IEnumerable bottomSidePoints = bottomSideCurve.GenerateSide(width).
- Select(p => new Point(p.X, p.Y + height)); // parallel shift, so that (0.0;0.0);(width;0.0) is shifted to (0.0;height);(width;height)
+ Select(p => new Point(p.X + xOffset, p.Y + height)); // parallel shift, so that (0.0;0.0);(width;0.0) is shifted to (0.0;height);(width;height)
result.AddRange(bottomSidePoints);
@@ -78,24 +78,29 @@ public interface IOscillationGenerator
IEnumerable GeneratePeriod(double xPeriod, double signalMaxY);
}
+ public enum OscillationAlignment { Left, Center, Right }
+
///
/// Generates a side curve by repeating integer repeating periods provided by oscillationGenerator
///
public class OscillatingSignalCurveGenerator : ISideCurveGenerator
{
private double xPeriod, signalMaxY;
+ private OscillationAlignment alignment;
IOscillationGenerator generator;
/// The period of the pattern allong X axis
- /// the avsolute hight of the pattern along Y axis
+ /// the absolute hight of the pattern along Y axis
/// Which signal to generate
- public OscillatingSignalCurveGenerator(double xPeriod, double signalMaxY, IOscillationGenerator generator)
+ /// Where the straight part will be / where to stick the signal curve
+ public OscillatingSignalCurveGenerator(double xPeriod, double signalMaxY, IOscillationGenerator generator, OscillationAlignment alignment)
{
if (signalMaxY < 0)
throw new ArgumentException("signalMaxY must be non-negative");
this.xPeriod = xPeriod;
this.signalMaxY = signalMaxY;
this.generator = generator;
+ this.alignment = alignment;
}
public IEnumerable GenerateSide(double length)
@@ -104,15 +109,35 @@ public IEnumerable GenerateSide(double length)
double straitEndsLength = length - periods * xPeriod;
List result = new List();
+
+ double leftOffset = 0.0;
+ double rightOffset = 0.0;
+ switch (alignment)
+ {
+ case OscillationAlignment.Center:
+ leftOffset = straitEndsLength / 2;
+ rightOffset = straitEndsLength / 2;
+ break;
+ case OscillationAlignment.Left:
+ leftOffset = 0.0;
+ rightOffset = straitEndsLength;
+ break;
+ case OscillationAlignment.Right:
+ leftOffset = straitEndsLength;
+ rightOffset = 0.0;
+ break;
+ }
+
+
//starting straight line
result.Add(new Point(0.0, 0.0));
- result.Add(new Point(straitEndsLength * 0.5, 0.0));
+ result.Add(new Point(leftOffset, 0.0));
//drawing curves
double miniStep = xPeriod * 0.5;
for (int i = 0; i < periods; i++)
{
- double xOffset = straitEndsLength * 0.5 + i * xPeriod;
+ double xOffset = leftOffset + i * xPeriod;
IEnumerable periodPoints = generator.GeneratePeriod(xPeriod, signalMaxY).Select(p => new Point(p.X + xOffset, p.Y));
result.AddRange(periodPoints);
diff --git a/Application/AnnotationPlane/Columns/VisualColumnView.xaml b/Application/AnnotationPlane/Columns/VisualColumnView.xaml
index 22d233d..aa7f8e1 100644
--- a/Application/AnnotationPlane/Columns/VisualColumnView.xaml
+++ b/Application/AnnotationPlane/Columns/VisualColumnView.xaml
@@ -43,13 +43,13 @@
+
-
-
+
-
+
diff --git a/Application/AnnotationPlane/Columns/VisualColumnView.xaml.cs b/Application/AnnotationPlane/Columns/VisualColumnView.xaml.cs
index 65f185a..31fef39 100644
--- a/Application/AnnotationPlane/Columns/VisualColumnView.xaml.cs
+++ b/Application/AnnotationPlane/Columns/VisualColumnView.xaml.cs
@@ -38,30 +38,41 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste
public static class SideCurveGeneratorFactory
{
private static ISideCurveGenerator straight = new StraightSideCurveGenerator();
- private static ISideCurveGenerator steps = new OscillatingSignalCurveGenerator(20, 3, new StepOscillationGenerator());
- private static ISideCurveGenerator wave = new OscillatingSignalCurveGenerator(20, 3, new SinOscillationGenerator(11));
- private static ISideCurveGenerator zigzag = new OscillatingSignalCurveGenerator(20, 3, new ZigZagOscillationGenerator());
+ private static ISideCurveGenerator stepsVertical = new OscillatingSignalCurveGenerator(20, 3, new StepOscillationGenerator(), OscillationAlignment.Center);
+ private static ISideCurveGenerator waveVertical = new OscillatingSignalCurveGenerator(20, 3, new SinOscillationGenerator(11), OscillationAlignment.Center);
+ private static ISideCurveGenerator zigzagVertical = new OscillatingSignalCurveGenerator(20, 3, new ZigZagOscillationGenerator(), OscillationAlignment.Center);
+ private static ISideCurveGenerator waveHorizontalLeft = new OscillatingSignalCurveGenerator(20, 3, new SinOscillationGenerator(11), OscillationAlignment.Left);
+ private static ISideCurveGenerator waveHorizontalRight = new OscillatingSignalCurveGenerator(20, 3, new SinOscillationGenerator(11), OscillationAlignment.Right);
+ private static ISideCurveGenerator waveHorizontalCenter = new OscillatingSignalCurveGenerator(20, 3, new SinOscillationGenerator(11), OscillationAlignment.Center);
public static ISideCurveGenerator GetGeneratorFor(Template.RightSideFormEnum rightSideForm) {
switch (rightSideForm) {
case Template.RightSideFormEnum.NotDefined: return straight;
case Template.RightSideFormEnum.Straight: return straight;
- case Template.RightSideFormEnum.Steps: return steps;
- case Template.RightSideFormEnum.Wave: return wave;
- case Template.RightSideFormEnum.ZigZag: return zigzag;
+ case Template.RightSideFormEnum.Steps: return stepsVertical;
+ case Template.RightSideFormEnum.Wave: return waveVertical;
+ case Template.RightSideFormEnum.ZigZag: return zigzagVertical;
default:
throw new NotSupportedException("Unknown right side form");
}
}
- public static ISideCurveGenerator GetGeneratorFor(Template.BottomSideFormEnum bottomSideForm)
+ public static ISideCurveGenerator GetGeneratorFor(Template.BottomSideFormEnum bottomSideForm, OscillationAlignment alignment)
{
switch (bottomSideForm)
{
case Template.BottomSideFormEnum.NotDefined: return straight;
case Template.BottomSideFormEnum.Straight: return straight;
- case Template.BottomSideFormEnum.Wave: return wave;
+ case Template.BottomSideFormEnum.Wave:
+ switch (alignment)
+ {
+ case OscillationAlignment.Left: return waveHorizontalLeft;
+ case OscillationAlignment.Right: return waveHorizontalRight;
+ case OscillationAlignment.Center: return waveHorizontalCenter;
+ default:
+ throw new NotSupportedException("Unknown wave alignment");
+ }
case Template.BottomSideFormEnum.Dotted: return straight;
default:
throw new NotSupportedException("Unknown bottom side form");
@@ -113,11 +124,21 @@ public object Convert(object[] values, Type targetType, object parameter, Cultur
{
if (values.Length != 3)
return null;
- double width = (double)values[0];
- double height = (double)values[1];
- Template.BottomSideFormEnum bottomSideForm = (Template.BottomSideFormEnum)values[2];
- ISideCurveGenerator bottomSideGenerator = SideCurveGeneratorFactory.GetGeneratorFor(bottomSideForm);
- return new PointCollection(Drawing.GetBottomPolyline(width, height, bottomSideGenerator));
+ if (values[0] == DependencyProperty.UnsetValue) return new PointCollection();
+ Template.BottomSideFormEnum bottomSideForm = (Template.BottomSideFormEnum)values[0];
+ ISideCurveGenerator bottomRightAlignedSideGenerator = SideCurveGeneratorFactory.GetGeneratorFor(bottomSideForm, OscillationAlignment.Right);
+ ISideCurveGenerator bottomLeftAlignedSideGenerator = SideCurveGeneratorFactory.GetGeneratorFor(bottomSideForm, OscillationAlignment.Left);
+ double currentWidth = (double)values[1];
+ double previousWidth = (double)values[2];
+ // splitting the layer boundary into two fragments
+ // getting the minimum length between the two layers
+ double minCrepWidth = (currentWidth < previousWidth) ? currentWidth : previousWidth;
+ // getting the difference between the lengths
+ double crepWidthDiff = (currentWidth > previousWidth) ? currentWidth - minCrepWidth : previousWidth - minCrepWidth;
+ var bottomBoundaryRightAlign = Drawing.GetBottomPolyline(0.0, minCrepWidth, 0.0, bottomRightAlignedSideGenerator);
+ var bottomBoundaryLeftAlign = Drawing.GetBottomPolyline(minCrepWidth, crepWidthDiff, 0.0, bottomLeftAlignedSideGenerator);
+ var bottomBoundary = new PointCollection(bottomBoundaryRightAlign.Concat(bottomBoundaryLeftAlign));
+ return bottomBoundary;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
@@ -137,10 +158,10 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
case Template.BottomSideFormEnum.NotDefined:
case Template.BottomSideFormEnum.Straight:
case Template.BottomSideFormEnum.Wave:
- strokeArr = new DoubleCollection() { 3, 0 };
+ strokeArr = new DoubleCollection() { 5, 0 };
break;
case Template.BottomSideFormEnum.Dotted:
- strokeArr = new DoubleCollection() { 3, 3 };
+ strokeArr = new DoubleCollection() { 5, 5 };
break;
default:
break;
diff --git a/Application/Intervals/BoreIntervalsView.xaml b/Application/Intervals/BoreIntervalsView.xaml
index bbf1b8d..ec13d07 100644
--- a/Application/Intervals/BoreIntervalsView.xaml
+++ b/Application/Intervals/BoreIntervalsView.xaml
@@ -49,7 +49,7 @@
-
+
diff --git a/Application/Reports/SVG/LayeredColumnPainter.cs b/Application/Reports/SVG/LayeredColumnPainter.cs
index 5f72b35..ba1a7ee 100644
--- a/Application/Reports/SVG/LayeredColumnPainter.cs
+++ b/Application/Reports/SVG/LayeredColumnPainter.cs
@@ -37,10 +37,10 @@ public override RenderedSvg RenderColumn()
LayerVM[] layers = columnVm.Layers.ToArray();
double boundary = 0.0;
for (int i = 0; i < layers.Length; i++)
- {
+ {
LayerVM lVM = layers[i];
+ boundary += lVM.Length;
if (i < layers.Length - 1) {
- boundary += lVM.Length;
SvgLine line = new SvgLine();
line.Stroke = blackPaint;
line.StartX = Helpers.dtos(0.0);
@@ -49,6 +49,7 @@ public override RenderedSvg RenderColumn()
line.EndY = Helpers.dtos(boundary);
group.Children.Add(line);
}
+ // drawing layer itself
var layerSvg = layerPainter.Paint(layers[i], width, lVM.Length);
layerSvg.Transforms.Add(new Svg.Transforms.SvgTranslate(0.0f, (float)(boundary - lVM.Length)));
group.Children.Add(layerSvg);
diff --git a/Application/Reports/SVG/VisualColumnPainter.cs b/Application/Reports/SVG/VisualColumnPainter.cs
index 53c8837..a703c51 100644
--- a/Application/Reports/SVG/VisualColumnPainter.cs
+++ b/Application/Reports/SVG/VisualColumnPainter.cs
@@ -31,13 +31,10 @@ private static void AddPointToCollection(SvgPointCollection points, Point point)
public override RenderedSvg RenderColumn()
{
- var result = base.RenderColumn();
-
+ var result = base.RenderColumn();
SvgGroup group = new SvgGroup();
- VisualLayerPresentingVM[] layers = vm.Layers.ToArray();
-
-
+ VisualLayerPresentingVM[] layers = vm.Layers.ToArray();
for (int i = 0; i < layers.Length; i++)
{
@@ -72,11 +69,18 @@ public override RenderedSvg RenderColumn()
levelGroup.Children.Add(rightEdge);
- ISideCurveGenerator bottomSideCurveGenerator = null;
+ ISideCurveGenerator bottomSideLeftAlignedCurveGenerator = null;
+ ISideCurveGenerator bottomSideRightAlignedCurveGenerator = null;
if ((lvm.BottomSideClass != null) && (lvm.BottomSideClass.CurrentClass != null))
- bottomSideCurveGenerator = SideCurveGeneratorFactory.GetGeneratorFor(lvm.BottomSideClass.CurrentClass.BottomSideForm);
+ {
+ bottomSideLeftAlignedCurveGenerator = SideCurveGeneratorFactory.GetGeneratorFor(lvm.BottomSideClass.CurrentClass.BottomSideForm, OscillationAlignment.Left);
+ bottomSideRightAlignedCurveGenerator = SideCurveGeneratorFactory.GetGeneratorFor(lvm.BottomSideClass.CurrentClass.BottomSideForm, OscillationAlignment.Right);
+ }
else
- bottomSideCurveGenerator = SideCurveGeneratorFactory.GetGeneratorFor(AnnotationPlane.Template.BottomSideFormEnum.NotDefined);
+ {
+ bottomSideLeftAlignedCurveGenerator = SideCurveGeneratorFactory.GetGeneratorFor(AnnotationPlane.Template.BottomSideFormEnum.NotDefined, OscillationAlignment.Left);
+ bottomSideRightAlignedCurveGenerator = SideCurveGeneratorFactory.GetGeneratorFor(AnnotationPlane.Template.BottomSideFormEnum.NotDefined, OscillationAlignment.Right);
+ }
SvgPolyline bottomEdge = new SvgPolyline
{
@@ -88,12 +92,32 @@ public override RenderedSvg RenderColumn()
{
if (lvm.BottomSideClass.CurrentClass.BottomSideForm == AnnotationPlane.Template.BottomSideFormEnum.Dotted)
{
- bottomEdge.StrokeDashArray = new List() { 3, 3 }.
- Select(p => new SvgUnit(p)) as SvgUnitCollection;
+ var dashedCollection = new SvgUnitCollection();
+ dashedCollection.AddRange(new[] { new SvgUnit(SvgUnitType.User, 5), new SvgUnit(SvgUnitType.User, 5) });
+ bottomEdge.StrokeDashArray = dashedCollection;
}
}
- var bottomPoints = Drawing.GetBottomPolyline(lvm.Width, lvm.Height, bottomSideCurveGenerator).ToArray();
+ double currentWidth = lvm.Width;
+ double minCrepWidth = currentWidth;
+ double crepWidthDiff = 0.0;
+ if (i < layers.Length - 1)
+ {
+ VisualLayerPresentingVM nlvm = layers[i + 1];
+
+ // splitting the layer boundary into two fragments
+ // getting the minimum length between the two layers
+ minCrepWidth = (currentWidth < nlvm.Width) ? currentWidth : nlvm.Width;
+ // getting the difference between the lengths
+ crepWidthDiff = (currentWidth > nlvm.Width) ? currentWidth - minCrepWidth : nlvm.Width - minCrepWidth;
+ }
+
+ var bottomPointsRightAligned = Drawing.GetBottomPolyline(0.0, minCrepWidth, lvm.Height, bottomSideRightAlignedCurveGenerator).ToArray();
+ var bottomPointsLeftAligned = Drawing.GetBottomPolyline(minCrepWidth, crepWidthDiff, lvm.Height, bottomSideLeftAlignedCurveGenerator).ToArray();
+
+ var bottomPoints = new Point[bottomPointsRightAligned.Length + bottomPointsLeftAligned.Length];
+ bottomPointsRightAligned.CopyTo(bottomPoints, 0);
+ bottomPointsLeftAligned.CopyTo(bottomPoints, bottomPointsRightAligned.Length);
SvgPointCollection svgBottomPoints = new SvgPointCollection();
for (int j = 0; j < bottomPoints.Length; j++)