public static Geometry CreateGeometry(GunVerticalTraverseComponentViewModel traverse, double size, Point center, double geometryRotation = 0, double margin = 0, double padding = 0, Func <double, double> verticalTraverseTransform = null) { if (verticalTraverseTransform == null) { verticalTraverseTransform = GunTraverseHelper.DefaultVerticalTraverseTransform; } if (traverse.HasSingularValue && traverse.HorizontalTraverse.Range == 360) { var radius = size / 2 - margin; return(new EllipseGeometry(center, radius, radius)); } var maxRadiusInDegrees = traverse.MaximumTraverse; var scale = (size / 2 - margin - padding) / maxRadiusInDegrees; Func <double, double> radiusConverter = r => padding + Math.Max(verticalTraverseTransform(r) * scale, 0); return(traverse.IsPost909Format ? GunTraverseHelper.CreateGeometryPost909(traverse, center, radiusConverter, geometryRotation) : GunTraverseHelper.CreateGeometryPre909(traverse, center, radiusConverter, geometryRotation)); }
public static Geometry CreateGeometry(GunVerticalTraverseComponentViewModel traverse, Point center, Func <double, double> radiusConverter, double geometryRotation = 0) { if (traverse.IsPost909Format) { return(GunTraverseHelper.CreateGeometryPost909(traverse, center, radiusConverter, geometryRotation)); } return(GunTraverseHelper.CreateGeometryPre909(traverse, center, radiusConverter, geometryRotation)); }