public FindObjectCenterOnLineInstance(FindObjectCenterOnLineDefinition theDefinition, TestExecution testExecution) : base(theDefinition, testExecution) { if (theDefinition.SourceImage == null) { throw new ArgumentException(Name + " doesn't have SourceImage defined."); } mSourceImage = testExecution.ImageRegistry.GetObject(theDefinition.SourceImage.Name); if (theDefinition.ObjectColorDefinition == null) { throw new ArgumentException(Name + " doesn't have ObjectColorDefinition defined."); } mObjectColorDefinition = testExecution.GetColorMatcher(theDefinition.ObjectColorDefinition.Name); if (theDefinition.SearchBackgroundColorDefinition == null) { throw new ArgumentException(Name + " doesn't have SearchBackgroundColorDefinition defined."); } mSearchBackgroundColorDefinition = testExecution.GetColorMatcher(theDefinition.SearchBackgroundColorDefinition.Name); if (theDefinition.SearchPath == null) { throw new ArgumentException(Name + " doesn't have SearchPath defined."); } mSearchPath = testExecution.ObjectBasedLineDecorationRegistry.GetObject(theDefinition.SearchPath.Name); if (theDefinition.SearchSpeed == null) { throw new ArgumentException(Name + " doesn't have SearchSpeed defined."); } mSearchSpeed = testExecution.DataValueRegistry.GetObject(theDefinition.SearchSpeed.Name); if (theDefinition.RequiredConsecutiveColorMatches == null) { throw new ArgumentException(Name + " doesn't have RequiredConsecutiveColorMatches defined."); } mRequiredConsecutiveColorMatches = testExecution.DataValueRegistry.GetObject(theDefinition.RequiredConsecutiveColorMatches.Name); if (theDefinition.SearchDirection == Direction.NotDefined) { throw new ArgumentException(Name + " doesn't have SearchDirection defined."); } mSearchDirection = theDefinition.SearchDirection; mResultX = new GeneratedValueInstance(theDefinition.ResultX, testExecution); mResultY = new GeneratedValueInstance(theDefinition.ResultY, testExecution); }
public ColorMatchCountInstance(ColorMatchCountDefinition theDefinition, TestExecution testExecution) : base(theDefinition, testExecution) { if (theDefinition.SourceImage == null) { throw new ArgumentException(Name + " doesn't have SourceImage defined."); } mSourceImage = testExecution.ImageRegistry.GetObject(theDefinition.SourceImage.Name); if (theDefinition.ColorMatchDefinition == null) { throw new ArgumentException(Name + " doesn't have ColorMatchDefinition defined."); } mColorMatcher = testExecution.GetColorMatcher(theDefinition.ColorMatchDefinition.Name); if (theDefinition.ROI == null) { throw new ArgumentException(Name + " doesn't have ROI defined."); } mROI = testExecution.ROIRegistry.GetObject(theDefinition.ROI.Name); mResult = new GeneratedValueInstance(theDefinition.Result, testExecution); mCreateMarkedImage = theDefinition.CreateMarkedImage; mMarkColor = theDefinition.MarkColor; if (theDefinition.ImageToMark != null) { mImageToMark = testExecution.ImageRegistry.GetObject(theDefinition.ImageToMark.Name); } }
public ColorMatchCountOverRectangleInstance(ColorMatchCountOverRectangleDefinition theDefinition, TestExecution testExecution) : base(theDefinition, testExecution) { // TODO: should this effort be part of the definition? mColorMatcher = testExecution.GetColorMatcher(theDefinition.ColorMatchDefinition.Name); ROIInstance theROI = testExecution.ROIRegistry.GetObject(theDefinition.ROI.Name); if (theROI is IRectangleROIInstance) { mROI = (IRectangleROIInstance)theROI; } else { throw new ArgumentException("ColorMatchCount currently only supports Rectangle ROIs."); } mSourceImage = testExecution.ImageRegistry.GetObject(theDefinition.SourceImage.Name); mResult = new GeneratedValueInstance(theDefinition.Result, testExecution); mCreateMarkedImage = theDefinition.CreateMarkedImage; mMarkColor = theDefinition.MarkColor; if (theDefinition.ImageToMark != null) { mImageToMark = testExecution.ImageRegistry.GetObject(theDefinition.ImageToMark.Name); } }
public OrColorMatchInstance(OrColorMatchDefinition theDefinition, TestExecution testExecution) : base(theDefinition, testExecution) { foreach (ColorMatchDefinition def in theDefinition.SubMatchers) { mReferencedColorMatchers.Add(testExecution.GetColorMatcher(def.Name)); } }
public FindColorOnLineInstance(FindColorOnLineDefinition theDefinition, TestExecution testExecution) : base(theDefinition, testExecution) { if (theDefinition.ColorMatchDefinition == null) { throw new ArgumentException(Name + " doesn't have ColorMatchDefinition defined."); } mColorMatcher = testExecution.GetColorMatcher(theDefinition.ColorMatchDefinition.Name); if (theDefinition.SourceImage == null) { throw new ArgumentException(Name + " doesn't have SourceImage defined."); } mSourceImage = testExecution.ImageRegistry.GetObject(theDefinition.SourceImage.Name); if (theDefinition.StartX == null) { throw new ArgumentException(Name + " doesn't have StartX defined."); } mStartX = testExecution.DataValueRegistry.GetObject(theDefinition.StartX.Name); if (theDefinition.StartY == null) { throw new ArgumentException(Name + " doesn't have StartY defined."); } mStartY = testExecution.DataValueRegistry.GetObject(theDefinition.StartY.Name); if (theDefinition.SlopeRise == null) { throw new ArgumentException(Name + " doesn't have SlopeRise defined."); } mSlopeRise = testExecution.DataValueRegistry.GetObject(theDefinition.SlopeRise.Name); if (theDefinition.SlopeRun == null) { throw new ArgumentException(Name + " doesn't have SlopeRun defined."); } mSlopeRun = testExecution.DataValueRegistry.GetObject(theDefinition.SlopeRun.Name); if (theDefinition.RequiredConsecutivePixels == null) { throw new ArgumentException(Name + " doesn't have RequiredConsecutivePixels defined."); } mRequiredConsecutivePixels = testExecution.DataValueRegistry.GetObject(theDefinition.RequiredConsecutivePixels.Name); mResultX = new GeneratedValueInstance(theDefinition.ResultX, testExecution); mResultY = new GeneratedValueInstance(theDefinition.ResultY, testExecution); mSearchEndX = new GeneratedValueInstance(theDefinition.SearchEndX, testExecution); mSearchEndY = new GeneratedValueInstance(theDefinition.SearchEndY, testExecution); mSearchPath = new ObjectBasedLineDecorationInstance(theDefinition.SearchPath, testExecution); }
public ROIWithColorExceptionInstance(ROIWithColorExceptionDefinition theDefinition, TestExecution theExecution) : base(theDefinition, theExecution) { if (theDefinition.MainROI == null) { throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to MainROI"); } if (theDefinition.ColorException == null) { throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to ColorException"); } mMainROI = theExecution.ROIRegistry.GetObject(theDefinition.MainROI.Name); mColorException = theExecution.GetColorMatcher(theDefinition.ColorException.Name); }
public FindCornerFromInsideInstance(FindCornerFromInsideDefinition theDefinition, TestExecution testExecution) : base(theDefinition, testExecution) { // mColorMatcher = testExecution.GetColorMatcher(theDefinition.ColorMatchDefinition); mSourceImage = testExecution.ImageRegistry.GetObject(theDefinition.SourceImage.Name); mStartX = testExecution.DataValueRegistry.GetObject(theDefinition.StartX.Name); mStartY = testExecution.DataValueRegistry.GetObject(theDefinition.StartY.Name); mFollowingEdgeColorDefinition = testExecution.GetColorMatcher(theDefinition.FollowingEdgeColorDefinition.Name); mTargetEdgeColorDefinition = testExecution.GetColorMatcher(theDefinition.TargetEdgeColorDefinition.Name); mSearchBackgroundColorDefinition = testExecution.GetColorMatcher(theDefinition.SearchBackgroundColorDefinition.Name); mSearchDirection = theDefinition.SearchDirection; mTargetEdgeDirection = theDefinition.TargetEdgeDirection; mTargetEdgeWidth = testExecution.DataValueRegistry.GetObject(theDefinition.TargetEdgeWidth.Name); mResultX = new GeneratedValueInstance(theDefinition.ResultX, testExecution); mResultY = new GeneratedValueInstance(theDefinition.ResultY, testExecution); /* * mSearchEndX = new GeneratedValueInstance(theDefinition.SearchEndX, testExecution); * mSearchEndY = new GeneratedValueInstance(theDefinition.SearchEndY, testExecution); * * mSearchPath = new LineDecorationInstance(theDefinition.SearchPath, testExecution); */ }
public FindBoundingRectangleInstance(FindBoundingRectangleDefinition theDefinition, TestExecution testExecution) : base(theDefinition, testExecution) { mFindBoundingRectangleDefinition = theDefinition; if (theDefinition.SourceImage == null) { throw new ArgumentException(Name + " doesn't have SourceImage defined."); } mSourceImage = testExecution.ImageRegistry.GetObject(theDefinition.SourceImage.Name); if (theDefinition.StartPoint_X == null) { throw new ArgumentException(Name + " doesn't have StartPoint_X defined."); } mStartPoint_X = testExecution.DataValueRegistry.GetObject(theDefinition.StartPoint_X.Name); if (theDefinition.StartPoint_Y == null) { throw new ArgumentException(Name + " doesn't have StartPoint_Y defined."); } mStartPoint_Y = testExecution.DataValueRegistry.GetObject(theDefinition.StartPoint_Y.Name); if (theDefinition.ColorMatchDefinition == null) { throw new ArgumentException(Name + " doesn't have ColorMatchDefinition defined."); } mColorMatchDefinition = testExecution.GetColorMatcher(theDefinition.ColorMatchDefinition.Name); if (theDefinition.Enabled == null) { throw new ArgumentException(Name + " doesn't have Enabled defined."); } mEnabled = testExecution.DataValueRegistry.GetObject(theDefinition.Enabled.Name); if (theDefinition.StepSize == null) { throw new ArgumentException(Name + " doesn't have StepSize defined."); } mStepSize = testExecution.DataValueRegistry.GetObject(theDefinition.StepSize.Name); if (theDefinition.DetailedSearch == null) { throw new ArgumentException(Name + " doesn't have DetailedSearch defined."); } mDetailedSearch = testExecution.DataValueRegistry.GetObject(theDefinition.DetailedSearch.Name); mLeftBound = new GeneratedValueInstance(theDefinition.LeftBound, testExecution); mRightBound = new GeneratedValueInstance(theDefinition.RightBound, testExecution); mTopBound = new GeneratedValueInstance(theDefinition.TopBound, testExecution); mBottomBound = new GeneratedValueInstance(theDefinition.BottomBound, testExecution); if (theDefinition.ImageMarkingEnabled == null) { throw new ArgumentException(Name + " doesn't have ImageMarkingEnabled defined."); } mImageMarkingEnabled = testExecution.DataValueRegistry.GetObject(theDefinition.ImageMarkingEnabled.Name); if (theDefinition.ImageToMark != null) { mImageToMark = testExecution.ImageRegistry.GetObject(theDefinition.ImageToMark.Name); } //mResultantRay = new ValueBasedLineDecorationInstance(theDefinition.ResultantRay, testExecution); mAutoSave = theDefinition.AutoSave; mMarkColor = theDefinition.MarkColor; }
public NotColorMatchInstance(NotColorMatchDefinition theDefinition, TestExecution testExecution) : base(theDefinition, testExecution) { mReferencedColorMatch = testExecution.GetColorMatcher(theDefinition.SubMatcher.Name); }
public FindBlobOfSizeAndColorInstance(FindBlobOfSizeAndColorDefinition theDefinition, TestExecution testExecution) : base(theDefinition, testExecution) { mFindBlobOfSizeAndColorDefinition = theDefinition; if (theDefinition.SourceImage == null) { throw new ArgumentException(Name + " doesn't have SourceImage defined."); } mSourceImage = testExecution.ImageRegistry.GetObject(theDefinition.SourceImage.Name); if (theDefinition.ROI == null) { throw new ArgumentException(Name + " doesn't have ROI defined."); } ROIInstance theROI = testExecution.ROIRegistry.GetObject(theDefinition.ROI.Name); if (!(theROI is IRectangleROIInstance)) { throw new ArgumentException(Name + " requires a rectangle ROI. " + theROI.Name + " isn't a rectangle."); } mROI = (IRectangleROIInstance)theROI; if (theDefinition.ExpectedObjectWidth != null) { mExpectedObjectWidth = testExecution.DataValueRegistry.GetObject(theDefinition.ExpectedObjectWidth.Name); } if (theDefinition.ExpectedObjectHeight != null) { mExpectedObjectHeight = testExecution.DataValueRegistry.GetObject(theDefinition.ExpectedObjectHeight.Name); } if (theDefinition.AllowedSizeVariation != null) { mAllowedSizeVariation = testExecution.DataValueRegistry.GetObject(theDefinition.AllowedSizeVariation.Name); } if (theDefinition.MinObjectHeight != null) { mMinObjectHeight = testExecution.DataValueRegistry.GetObject(theDefinition.MinObjectHeight.Name); } if (theDefinition.MinObjectWidth != null) { mMinObjectWidth = testExecution.DataValueRegistry.GetObject(theDefinition.MinObjectWidth.Name); } if (theDefinition.MaxObjectHeight != null) { mMaxObjectHeight = testExecution.DataValueRegistry.GetObject(theDefinition.MaxObjectHeight.Name); } if (theDefinition.MaxObjectWidth != null) { mMaxObjectWidth = testExecution.DataValueRegistry.GetObject(theDefinition.MaxObjectWidth.Name); } if (theDefinition.ColorMatchDefinition == null) { throw new ArgumentException(Name + " doesn't have ColorMatchDefinition defined."); } mColorMatchDefinition = testExecution.GetColorMatcher(theDefinition.ColorMatchDefinition.Name); if (theDefinition.Enabled == null) { throw new ArgumentException(Name + " doesn't have Enabled defined."); } mEnabled = testExecution.DataValueRegistry.GetObject(theDefinition.Enabled.Name); if (theDefinition.StepSize == null) { throw new ArgumentException(Name + " doesn't have StepSize defined."); } mStepSize = testExecution.DataValueRegistry.GetObject(theDefinition.StepSize.Name); if (theDefinition.DetailedSearch == null) { throw new ArgumentException(Name + " doesn't have DetailedSearch defined."); } mDetailedSearch = testExecution.DataValueRegistry.GetObject(theDefinition.DetailedSearch.Name); mLeftBound = new GeneratedValueInstance(theDefinition.LeftBound, testExecution); mRightBound = new GeneratedValueInstance(theDefinition.RightBound, testExecution); mTopBound = new GeneratedValueInstance(theDefinition.TopBound, testExecution); mBottomBound = new GeneratedValueInstance(theDefinition.BottomBound, testExecution); if (theDefinition.ImageMarkingEnabled == null) { throw new ArgumentException(Name + " doesn't have ImageMarkingEnabled defined."); } mImageMarkingEnabled = testExecution.DataValueRegistry.GetObject(theDefinition.ImageMarkingEnabled.Name); if (theDefinition.ImageToMark != null) { mImageToMark = testExecution.ImageRegistry.GetObject(theDefinition.ImageToMark.Name); } //mResultantRay = new ValueBasedLineDecorationInstance(theDefinition.ResultantRay, testExecution); mAutoSave = theDefinition.AutoSave; mMarkColor = theDefinition.MarkColor; }