コード例 #1
0
 /// <summary>
 /// constructor (from length, width, height)
 /// </summary>
 public FormEditBitmaps(double length, double width, double height, Color[] faceColors)
 {
     InitializeComponent();
     // set unit labels
     UnitsManager.AdaptUnitLabels(this);
     // set internal box properties
     _boxProperties = new BoxProperties(null, length, width, height);
     _boxProperties.SetAllColors(faceColors);
     // get textures
     _textures = _boxProperties.TextureListCopy;
     // set default face
     cbFace.SelectedIndex = 0;
     // set horizontal angle
     trackBarHorizAngle.Value = 225;
 }
コード例 #2
0
 internal BoxProperties ToCase(DataCase dtCase)
 {
     BoxProperties boxProperties = new BoxProperties(null
          , dtCase.OuterDimensions[0], dtCase.OuterDimensions[1], dtCase.OuterDimensions[2]
          , dtCase.InnerDimensions[0], dtCase.InnerDimensions[1], dtCase.InnerDimensions[2]);
     Color[] colors = new Color[6];
     for (int i = 0; i < 6; ++i) colors[i] = Color.Chocolate;
     boxProperties.Name = dtCase.Name;
     boxProperties.Description = dtCase.Description;
     boxProperties.SetAllColors(colors);
     boxProperties.ShowTape = true;
     boxProperties.TapeColor = Color.Beige;
     boxProperties.TapeWidth = UnitsManager.ConvertLengthFrom(50, UnitsManager.UnitSystem.UNIT_METRIC1);
     boxProperties.Weight = dtCase.Weight;
     boxProperties.NetWeight = new OptDouble(dtCase.NetWeight > 0.0, dtCase.NetWeight);
     return boxProperties;
 }
コード例 #3
0
 internal BoxProperties ToBox(DataBox dtBox)
 {
     BoxProperties boxProperties = new BoxProperties(null
         , dtBox.Dimensions[0], dtBox.Dimensions[1], dtBox.Dimensions[2]);
     boxProperties.Name = dtBox.Name;
     boxProperties.Description = dtBox.Description;
     Color[] colors = new Color[6];
     for (int i = 0; i < 6; ++i) colors[i] = Color.Turquoise;
     boxProperties.SetAllColors(colors);
     boxProperties.ShowTape = false;
     boxProperties.Weight = dtBox.Weight;
     boxProperties.NetWeight = new OptDouble(dtBox.NetWeight > 0, dtBox.NetWeight);
     return boxProperties;
 }
コード例 #4
0
 public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
 {
     BoxProperties boxProperties = new BoxProperties(null, (double)nudLength.Value, (double)nudWidth.Value, (double)nudHeight.Value);
     boxProperties.SetAllColors(_faceColors);
     boxProperties.TextureList = _textures;
     boxProperties.ShowTape = ShowTape;
     boxProperties.TapeColor = TapeColor;
     boxProperties.TapeWidth = TapeWidth;
     Box box = new Box(0, boxProperties);
     graphics.AddBox(box);
     graphics.AddDimensions(new DimensionCube((double)nudLength.Value, (double)nudWidth.Value, (double)nudHeight.Value));
 }
コード例 #5
0
 public BoxProperties CreateNewCase(BoxProperties boxProp)
 {
     // instantiate and initialize
     BoxProperties boxPropClone = new BoxProperties(this
         , boxProp.Length
         , boxProp.Width
         , boxProp.Height
         , boxProp.InsideLength
         , boxProp.InsideWidth
         , boxProp.InsideHeight);
     boxPropClone.Weight = boxProp.Weight;
     boxPropClone.NetWeight = boxProp.NetWeight;
     boxPropClone.Name = boxProp.Name;
     boxPropClone.Description = boxProp.Description;
     boxPropClone.SetAllColors(boxProp.Colors);
     boxPropClone.ShowTape = boxProp.ShowTape;
     boxPropClone.TapeWidth = boxProp.TapeWidth;
     boxPropClone.TapeColor = boxProp.TapeColor;
     // insert in list
     _typeList.Add(boxPropClone);
     // notify listeners
     NotifyOnNewTypeCreated(boxPropClone);
     Modify();
     return boxPropClone;
 }
コード例 #6
0
 /// <summary>
 /// Create a new case
 /// </summary>
 /// <param name="name"></param>
 /// <param name="description"></param>
 /// <param name="length"></param>
 /// <param name="width"></param>
 /// <param name="height"></param>
 /// <param name="insideLength"></param>
 /// <param name="insideWidth"></param>
 /// <param name="insideHeight"></param>
 /// <param name="weight"></param>
 /// <param name="colors"></param>
 /// <returns></returns>
 public BoxProperties CreateNewCase(
     string name, string description
     , double length, double width, double height
     , double insideLength, double insideWidth, double insideHeight
     , double weight
     , Color[] colors)
 {
     // instantiate and initialize
     BoxProperties boxProperties = new BoxProperties(this, length, width, height, insideLength, insideWidth, insideHeight);
     boxProperties.Weight = weight;
     boxProperties.Name = name;
     boxProperties.Description = description;
     boxProperties.SetAllColors(colors);
     // insert in list
     _typeList.Add(boxProperties);
     // notify listeners
     NotifyOnNewTypeCreated(boxProperties);
     Modify();
     return boxProperties;
 }
コード例 #7
0
 public void Draw(Graphics3DControl ctrl, Graphics3D graphics)
 {
     if (graphCtrlBoxCase == ctrl)
     {
         BoxProperties boxProperties = new BoxProperties(null
             , _caseOfBoxesProperties.Length, _caseOfBoxesProperties.Width, _caseOfBoxesProperties.Height);
         boxProperties.SetAllColors(_faceColors);
         boxProperties.TextureList = _textures;
         Box box = new Box(0, boxProperties);
         graphics.AddBox(box);
         graphics.AddDimensions(new DimensionCube(_caseOfBoxesProperties.Length, _caseOfBoxesProperties.Width, _caseOfBoxesProperties.Height));
     }
     else if (graphCtrlCaseDefinition == ctrl)
     {
         CaseDefinitionViewer viewer = new CaseDefinitionViewer(_caseOfBoxesProperties.CaseDefinition, _caseOfBoxesProperties.InsideBoxProperties, _caseOfBoxesProperties.CaseOptimConstraintSet);
         viewer.CaseProperties = _caseOfBoxesProperties;
         viewer.Orientation = new Basics.Orientation(HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
         viewer.Draw(graphics);
     }
 }
コード例 #8
0
 private void DrawBox()
 {
     try
     {
         // get horizontal angle
         double angle = trackBarHorizAngle.Value;
         // instantiate graphics
         Graphics3DImage graphics = new Graphics3DImage(pictureBox.Size);
         graphics.CameraPosition = new Vector3D(
             Math.Cos(angle * Math.PI / 180.0) * Math.Sqrt(2.0) * 10000.0
             , Math.Sin(angle * Math.PI / 180.0) * Math.Sqrt(2.0) * 10000.0
             , 10000.0);
         graphics.Target = Vector3D.Zero;
         graphics.SetViewport(-500.0f, -500.0f, 500.0f, 500.0f);
         // draw
         BoxProperties boxProperties = new BoxProperties(null, _boxProperties.Length, _boxProperties.Width, _boxProperties.Height);
         boxProperties.SetAllColors(_boxProperties.Colors);
         boxProperties.TextureList = _textures;
         Box box = new Box(0, boxProperties);
         graphics.AddBox(box);
         graphics.Flush();
         // set to picture box
         pictureBox.Image = graphics.Bitmap;
     }
     catch (Exception ex)
     {
         _log.Error(ex.ToString());
     }
 }