private static string ValidateAndGetPatternType(GuidancePattern guidancePattern)
{
switch (guidancePattern.GuidancePatternType)
{
case GuidancePatternTypeEnum.AbLine:
{
var abLine = guidancePattern as AbLine;
if (abLine == null || abLine.A == null || abLine.B == null)
return null;
}
return "1";
case GuidancePatternTypeEnum.APlus:
{
var aPlus = guidancePattern as APlus;
if (aPlus == null || aPlus.Point == null)
return null;
return "2";
}
case GuidancePatternTypeEnum.AbCurve:
{
var abCurve = guidancePattern as AbCurve;
if (abCurve == null || abCurve.Shape == null || abCurve.Shape.Count < 1)
return null;
return "3";
}
case GuidancePatternTypeEnum.CenterPivot:
{
var pivot = guidancePattern as CenterPivot;
if (pivot == null || pivot.Center == null)
return null;
return "4";
}
case GuidancePatternTypeEnum.Spiral:
{
var spiral = guidancePattern as Spiral;
if (spiral == null || spiral.Shape == null)
return null;
return "5";
}
}
return null;
}