快捷工具处添加比例尺开关
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
<UserControl.Resources>
|
||||
<behaviors:PointListToPointCollectionConverter x:Key="PointListToPointCollectionConverter" />
|
||||
<converters:ROITypeToVisibilityConverter x:Key="ROITypeToVisibilityConverter" />
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
|
||||
</UserControl.Resources>
|
||||
<Border BorderBrush="Transparent" BorderThickness="1" ClipToBounds="True">
|
||||
<Grid>
|
||||
@@ -71,6 +72,95 @@
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<!-- 比例尺:位于图像坐标系内,随 LayoutTransform(缩放)与 RenderTransform(平移)与底图一致 -->
|
||||
<Grid
|
||||
x:Name="ScaleBarOverlay"
|
||||
Canvas.Left="0"
|
||||
Canvas.Top="0"
|
||||
Width="{Binding CanvasWidth, ElementName=root}"
|
||||
Height="{Binding CanvasHeight, ElementName=root}"
|
||||
Panel.ZIndex="10000"
|
||||
IsHitTestVisible="False"
|
||||
Visibility="{Binding ShowScaleBar, ElementName=root, Converter={StaticResource BoolToVisibilityConverter}}">
|
||||
<Border
|
||||
Margin="0,0,0,12"
|
||||
Padding="0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Bottom"
|
||||
Background="Transparent">
|
||||
<StackPanel VerticalAlignment="Bottom" Orientation="Horizontal">
|
||||
<!-- 尺身:底线 + 端部刻度 + 内侧无刻度竖线 -->
|
||||
<Grid
|
||||
x:Name="ScaleBarTrack"
|
||||
Height="18"
|
||||
MinWidth="8"
|
||||
VerticalAlignment="Bottom"
|
||||
Width="{Binding ScaleBarLengthPixels, ElementName=root}">
|
||||
<Line
|
||||
X1="0"
|
||||
Y1="16"
|
||||
X2="{Binding ScaleBarLengthPixels, ElementName=root}"
|
||||
Y2="16"
|
||||
Stroke="Red"
|
||||
StrokeThickness="2"
|
||||
SnapsToDevicePixels="True" />
|
||||
<Line
|
||||
X1="0"
|
||||
X2="0"
|
||||
Y1="9"
|
||||
Y2="16"
|
||||
Stroke="Red"
|
||||
StrokeThickness="1.5"
|
||||
SnapsToDevicePixels="True" />
|
||||
<Line
|
||||
X1="{Binding ScaleBarLengthPixels, ElementName=root}"
|
||||
X2="{Binding ScaleBarLengthPixels, ElementName=root}"
|
||||
Y1="9"
|
||||
Y2="16"
|
||||
Stroke="Red"
|
||||
StrokeThickness="1.5"
|
||||
SnapsToDevicePixels="True" />
|
||||
<ItemsControl ItemsSource="{Binding ScaleBarMinorTickXs, ElementName=root}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<Canvas
|
||||
IsItemsHost="True"
|
||||
Width="{Binding ScaleBarLengthPixels, ElementName=root}"
|
||||
Height="18"
|
||||
ClipToBounds="False" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemContainerStyle>
|
||||
<Style TargetType="ContentPresenter">
|
||||
<Setter Property="Canvas.Left" Value="{Binding}" />
|
||||
<Setter Property="Canvas.Top" Value="0" />
|
||||
</Style>
|
||||
</ItemsControl.ItemContainerStyle>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Line
|
||||
X1="0"
|
||||
X2="0"
|
||||
Y1="11"
|
||||
Y2="16"
|
||||
Stroke="Red"
|
||||
StrokeThickness="1"
|
||||
SnapsToDevicePixels="True" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
<TextBlock
|
||||
Margin="6,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="11"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="Red"
|
||||
Text="{Binding ScaleBarCaption, ElementName=root}" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Canvas>
|
||||
</Grid>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user