private Graphics3DImage InitializeImageFromViewParameters(viewParameters vParam) { long[] iSize = vParam.imageSize.ToArray(); Graphics3DImage graphics = new Graphics3DImage(new Size((int)iSize[0], (int)iSize[1])); if (vParam.predefinedPointOfViewSpecified) { switch (vParam.predefinedPointOfView) { case pointOfViewValue.CORNER0: graphics.CameraPosition = Graphics3D.Corner_0; break; case pointOfViewValue.CORNER1: graphics.CameraPosition = Graphics3D.Corner_90; break; case pointOfViewValue.CORNER2: graphics.CameraPosition = Graphics3D.Corner_180; break; case pointOfViewValue.CORNER3: graphics.CameraPosition = Graphics3D.Corner_270; break; case pointOfViewValue.FRONT: graphics.CameraPosition = Graphics3D.Front; break; case pointOfViewValue.BACK: graphics.CameraPosition = Graphics3D.Back; break; case pointOfViewValue.LEFT: graphics.CameraPosition = Graphics3D.Left; break; case pointOfViewValue.RIGHT: graphics.CameraPosition = Graphics3D.Right; break; case pointOfViewValue.TOP: graphics.CameraPosition = Graphics3D.Top; break; default: break; } } return(graphics); }
private void FinalizeImageFromViewParameters(viewParameters vParam, Graphics3DImage graphics) { graphics.Flush(); // attempt to create directory string dirPath = Path.GetDirectoryName(vParam.path); try { Directory.CreateDirectory(dirPath); } catch (Exception ex) { _log.Error(ex.Message); } // check that directory exists if (!Directory.Exists(dirPath)) { throw new Exception(string.Format("Directory {0} does not exist!\n Can not generate output file!", Path.GetDirectoryName(vParam.path))); } // save image graphics.SaveAs(vParam.path); _log.Info(string.Format("Successfully saved file {0}", vParam.path)); }