OxyPlot.Annotations.ImageAnnotation.ps1

Set-StrictMode -Version 3

<#
.SYNOPSIS
 
Represents an annotation that shows an image.
 
.PARAMETER Layer
Sets the rendering layer of the annotation. The default value is OxyPlot.Annotations.AnnotationLayer.AboveSeries.
 
.PARAMETER XAxis
 
Gets the X axis.
 
.PARAMETER XAxisKey
Sets the X axis key.
 
.PARAMETER YAxis
 
Gets the Y axis.
 
.PARAMETER YAxisKey
Sets the Y axis key.
 
.PARAMETER ImageSource
Sets the image source.
 
.PARAMETER HorizontalAlignment
Sets the horizontal alignment.
 
.PARAMETER X
Sets the X position of the image.
 
.PARAMETER Y
Sets the Y position of the image.
 
.PARAMETER OffsetX
Sets the X offset.
 
.PARAMETER OffsetY
Sets the Y offset.
 
.PARAMETER Width
Sets the width.
 
.PARAMETER Height
Sets the height.
 
.PARAMETER Opacity
Sets the opacity (0-1).
 
.PARAMETER Interpolate
Sets a value indicating whether to apply smooth interpolation to the image.
 
.PARAMETER VerticalAlignment
Sets the vertical alignment.
 
.PARAMETER Parent
 
Gets the parent model of the element.
 
.PARAMETER Font
Sets the font. The default is null (use OxyPlot.PlotModel.DefaultFont.
 
If the value is null, the DefaultFont of the parent PlotModel will be used.
 
.PARAMETER FontSize
Sets the size of the font. The default is double.NaN (use OxyPlot.PlotModel.DefaultFontSize).
 
If the value is NaN, the DefaultFontSize of the parent PlotModel will be used.
 
.PARAMETER FontWeight
Sets the font weight. The default is FontWeights.Normal.
 
.PARAMETER PlotModel
 
Gets the parent OxyPlot.PlotElement.PlotModel.
 
.PARAMETER Tag
Sets an arbitrary object value that can be used to store custom information about this plot element. The default is null.
 
This property is analogous to Tag properties in other Microsoft programming models. Tag is intended to provide a pre-existing property location where you can store some basic custom information about any PlotElement without requiring you to subclass an element.
 
.PARAMETER TextColor
Sets the color of the text. The default is OxyColors.Automatic (use OxyPlot.PlotModel.TextColor).
 
If the value is OxyColors.Automatic, the TextColor of the parent PlotModel will be used.
 
.PARAMETER ToolTip
Sets the tool tip. The default is null.
 
.PARAMETER ActualFont
 
Gets the actual font.
 
.PARAMETER ActualFontSize
 
Gets the actual size of the font.
 
.PARAMETER ActualFontWeight
 
Gets the actual font weight.
 
.PARAMETER ActualTextColor
 
Gets the actual color of the text.
 
.PARAMETER ActualCulture
 
Gets the actual culture.
 
The culture is defined in the parent PlotModel.
 
.PARAMETER Selectable
Sets a value indicating whether this element can be selected. The default is true.
 
.PARAMETER SelectionMode
Sets the selection mode of items in this element. The default is SelectionMode.All.
 
This is only used by the select/unselect functionality, not by the rendering.
 
.PARAMETER ActualSelectedColor
 
Gets the actual selection color.
 
 
 
.DESCRIPTION
This cmdlet creates an OxyPlot.Annotations.ImageAnnotation object.
 
#>

function New-OxyImageAnnotation {
 [cmdletbinding()]
 [OutputType([OxyPlot.Annotations.ImageAnnotation])]
  param(
    [OxyPlot.OxyImage]$ImageSource,
    [OxyPlot.HorizontalAlignment]$HorizontalAlignment,
    [OxyPlot.PlotLength]$X,
    [OxyPlot.PlotLength]$Y,
    [OxyPlot.PlotLength]$OffsetX,
    [OxyPlot.PlotLength]$OffsetY,
    [OxyPlot.PlotLength]$Width,
    [OxyPlot.PlotLength]$Height,
    [object]$Opacity,
    [System.Boolean]$Interpolate,
    [OxyPlot.VerticalAlignment]$VerticalAlignment,
    [OxyPlot.Annotations.AnnotationLayer]$Layer,
    [System.String]$XAxisKey,
    [System.String]$YAxisKey,
    [System.String]$Font,
    [object]$FontSize,
    [object]$FontWeight,
    [System.Object]$Tag,
    [ValidatePattern('AliceBlue|AntiqueWhite|Aqua|Aquamarine|Automatic|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenrod|DarkGray|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGray|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGray|DodgerBlue|Firebrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|Goldenrod|Gray|Green|GreenYellow|Honeydew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenrodYellow|LightGray|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGray|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquamarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenrod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGray|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Undefined|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen|(#?[0-9a-f]{1,8})')][string]$TextColor,
    [System.String]$ToolTip,
    [System.Boolean]$Selectable,
    [OxyPlot.SelectionMode]$SelectionMode,
    [OxyPlot.Model]$Parent,

    [hashtable]$Options = @{},

    [string]$Style = "default",
    [OxyPlot.PlotModel]$AddTo
  )

  $a = New-Object OxyPlot.Annotations.ImageAnnotation

  Apply-OxyStyle $a $Style $MyInvocation

  $props = $PROPERTY_HASH["OxyPlot.Annotations.ImageAnnotation"]
  Assign-ParametersToProperties $props $PSBoundParameters $Options $a

  if ($AddTo -ne $null) {
    $AddTo.Annotations.Add($a)
    $AddTo.InvalidatePlot($false)
  }
  else {
    $a
  }
}