예제 #1
0
 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;
 }
 public viewSolution()
 {
     this.viewParametersField = new viewParameters();
     this.solutionRefField = new solutionRef();
 }
예제 #3
0
 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));
 }
 public static bool LoadFromFile(string fileName, out viewParameters obj)
 {
     System.Exception exception = null;
     return LoadFromFile(fileName, out obj, out exception);
 }
 /// <summary>
 /// Deserializes xml markup from file into an viewParameters object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output viewParameters object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out viewParameters obj, out System.Exception exception)
 {
     exception = null;
     obj = default(viewParameters);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 public static bool Deserialize(string xml, out viewParameters obj)
 {
     System.Exception exception = null;
     return Deserialize(xml, out obj, out exception);
 }
 /// <summary>
 /// Deserializes workflow markup into an viewParameters object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output viewParameters object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out viewParameters obj, out System.Exception exception)
 {
     exception = null;
     obj = default(viewParameters);
     try
     {
         obj = Deserialize(xml);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 public viewItem()
 {
     this.viewParametersField = new viewParameters();
 }