public override ExecutionResult Run(IStepExecutionContext context) { Guard.Against.Null(TargetImage, nameof(TargetImage)); Guard.Against.Null(Activity, nameof(Activity)); var autoCrop = _options.EquirectangularRender?.AutoCrop ?? false; var explicitCrop = _options.EquirectangularRender?.ExplicitCrop ?? false; // TODO document all of this - entire class really // Also, refactor. It's a mess. if (!autoCrop && !explicitCrop) { CropBounds = !FullEarthCoverage?GetPartialCoverageBounds(Activity, TargetImage) : TargetImage.Bounds(); return(ExecutionResult.Next()); } CropBounds = autoCrop ? GetAutoCropBounds(TargetImage) : GetExplicitCropBounds(TargetImage); _logger.LogInformation("Cropped image size: {Width} x {Height} px", CropBounds.Width, CropBounds.Height); return(ExecutionResult.Next()); }