/
SurfaceMeshContours.xaml
165 lines (135 loc) · 9.64 KB
/
SurfaceMeshContours.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<UserControl x:Class="SciChart.Examples.Examples.Charts3D.CreateASurfaceMeshChart.SurfaceMeshContours"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:s3D="http://schemas.abtsoftware.co.uk/scichart3D"
xmlns:ext="http://schemas.abtsoftware.co.uk/scichart/exampleExternals"
xmlns:createASurfaceMeshChart="clr-namespace:SciChart.Examples.Examples.Charts3D.CreateASurfaceMeshChart"
mc:Ignorable="d"
d:DesignHeight="400" d:DesignWidth="600">
<UserControl.Resources>
<s3D:GradientColorPalette x:Key="HeightColorMap" ContourColor="Black" ContourStrokeThickness="2.0">
<s3D:GradientColorPalette.GradientStops>
<GradientStop Offset="1.0" Color="Brown"/>
<GradientStop Offset="0.9" Color="Brown"/>
<GradientStop Offset="0.8" Color="SaddleBrown"/>
<GradientStop Offset="0.7" Color="DarkOrange"/>
<GradientStop Offset="0.6" Color="GreenYellow"/>
<GradientStop Offset="0.5" Color="DarkSalmon"/>
<GradientStop Offset="0.4" Color="BurlyWood"/>
<GradientStop Offset="0.3" Color="DarkKhaki"/>
<GradientStop Offset="0.2" Color="ForestGreen"/>
<GradientStop Offset="0.1" Color="Green"/>
<GradientStop Offset="0.0" Color="Aqua"/>
</s3D:GradientColorPalette.GradientStops>
</s3D:GradientColorPalette>
<ext:EnumValueToStringConverter x:Key="SelectedEnumValueConverter" />
<ext:LinearToLogarithmicValueConverter x:Key="LinearToLogarithmicValueConverter"/>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- The SciChart3DInteractionToolbar adds rotate, orbit, zoom, pan, zoom extents functionality -->
<!-- to the chart and is included for example purposes. -->
<!-- If you wish to know how to zoom and pan a 3D chart then do a search for Zoom Pan in the Examples suite! -->
<ext:SciChart3DInteractionToolbar TargetSurface="{Binding Source={x:Reference Name=sciChart}}" >
<ext:FlyoutMenuButton Style="{StaticResource FlyoutMenuButtonStyle}"
Content="CTRL"
FontSize="10"
Padding="0">
<ext:FlyoutMenuButton.PopupContent>
<StackPanel Orientation="Vertical" MinWidth="150">
<!-- Checkboxes to decide how the mesh should be drawn -->
<TextBlock FontSize="12" Text="Draw Mesh As" />
<ComboBox ItemsSource="{Binding Source={ext:EnumValues {x:Type s3D:DrawMeshAs}}}" SelectedItem="{Binding Source={x:Reference surfaceMeshRenderableSeries}, Path=DrawMeshAs, Mode=TwoWay, Converter={StaticResource SelectedEnumValueConverter}}" />
<ext:FlyoutSeparator/>
<!-- Checkbox for Mesh Skirt on or off -->
<TextBlock FontSize="12" Text="Mesh Skirt" />
<CheckBox FontSize="12" Margin="4" x:Name="CheckDrawSkirt" Content="Draw Mesh Skirt?" IsChecked="True" Checked="CheckDrawSkirtChanged" Unchecked="CheckDrawSkirtChanged"/>
<ext:FlyoutSeparator/>
<!-- Create the opacity slider -->
<TextBlock FontSize="12" Text="Opacity" />
<Slider Minimum="0.1" Maximum="1.0" x:Name="opacitySlider" Value="0.8" Margin="4" Orientation="Horizontal" HorizontalAlignment="Stretch"/>
<TextBlock FontSize="12" Text="Normal hardness" />
<Slider Minimum="0.0" Maximum="1.0" x:Name="normalHardnessSlider" Value="1.0" Margin="4" Orientation="Horizontal" HorizontalAlignment="Stretch"/>
<TextBlock FontSize="12" Text="Shininess" />
<Slider Minimum="0" Maximum="11" x:Name="shininessSlider" Margin="4" Orientation="Horizontal" HorizontalAlignment="Stretch"/>
</StackPanel>
</ext:FlyoutMenuButton.PopupContent>
</ext:FlyoutMenuButton>
<ext:FlyoutMenuButton Style="{StaticResource FlyoutMenuButtonStyle}"
Content="Cont"
FontSize="10"
Padding="0">
<ext:FlyoutMenuButton.PopupContent>
<StackPanel Orientation="Vertical" MinWidth="150">
<!-- Create the contour thickness slider -->
<TextBlock FontSize="12" Text="Contour thickness" />
<Slider Minimum="1" Maximum="5" x:Name="contourThicknessSlider" Value="1" Margin="4" Orientation="Horizontal" HorizontalAlignment="Stretch"/>
<!-- Create the contour inteval slider -->
<TextBlock FontSize="12" Text="Contour inteval" />
<Slider Minimum="2" Maximum="30" x:Name="contourIntervalSlider" Value="20" Margin="4" Orientation="Horizontal" HorizontalAlignment="Stretch"/>
<!-- Create the contour offset slider -->
<TextBlock FontSize="12" Text="Contour offset" />
<Slider Minimum="0.1" Maximum="30" x:Name="contourOffsetSlider" Value="0.1" Margin="4" Orientation="Horizontal" HorizontalAlignment="Stretch"/>
<!-- The contour color -->
<TextBlock FontSize="12" Text="Contour color" />
<ComboBox x:Name="contourComboBox"
Width="200"
Margin="3"
Background="#FF1C1C1F"
SelectedIndex="1"
SelectionChanged="ContourColorSelectionChanged">
<ComboBox.ItemTemplate>
<DataTemplate DataType="createASurfaceMeshChart:ColorModel">
<StackPanel Orientation="Horizontal">
<Rectangle Width="18"
Height="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Width}"
Margin="3 0"
Fill="{Binding Brush}"
RadiusX="2"
RadiusY="2" />
<TextBlock Margin="3 0"
VerticalAlignment="Center"
FontSize="14"
Foreground="White"
Text="{Binding ColorName}" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
</ext:FlyoutMenuButton.PopupContent>
</ext:FlyoutMenuButton>
</ext:SciChart3DInteractionToolbar>
<s3D:SciChart3DSurface x:Name="sciChart" Grid.Column="1" BorderThickness="0" WorldDimensions="600,300,300">
<s3D:SciChart3DSurface.RenderableSeries>
<s3D:SurfaceMeshRenderableSeries3D x:Name="surfaceMeshRenderableSeries"
DrawMeshAs="SolidWithContours"
ContourStrokeThickness="{Binding Source={x:Reference contourThicknessSlider}, Path=Value, Mode=TwoWay}"
ContourInterval="{Binding Source={x:Reference contourIntervalSlider}, Path=Value, Mode=TwoWay}"
ContourOffset="{Binding Source={x:Reference contourOffsetSlider}, Path=Value, Mode=TwoWay}"
Stroke="#77228B22"
Maximum="150"
StrokeThickness="2.0"
DrawSkirt="True"
Opacity="{Binding Source={x:Reference opacitySlider}, Path=Value, Mode=TwoWay}"
CellHardnessFactor="{Binding Source={x:Reference Name=normalHardnessSlider}, Path=Value, Mode=TwoWay}"
Shininess="{Binding Source={x:Reference Name=shininessSlider}, Path=Value, Mode=TwoWay, Converter={StaticResource LinearToLogarithmicValueConverter}}"
MeshColorPalette="{StaticResource HeightColorMap}"/>
</s3D:SciChart3DSurface.RenderableSeries>
<s3D:SciChart3DSurface.XAxis>
<s3D:NumericAxis3D />
</s3D:SciChart3DSurface.XAxis>
<s3D:SciChart3DSurface.YAxis>
<s3D:NumericAxis3D />
</s3D:SciChart3DSurface.YAxis>
<s3D:SciChart3DSurface.ZAxis>
<s3D:NumericAxis3D />
</s3D:SciChart3DSurface.ZAxis>
</s3D:SciChart3DSurface>
</Grid>
</UserControl>