/* public void updateheadingdirection(double _angle) * { * contentlayer.Children.Clear(); * // var axis = new Vector3D(0, 0, 1); * // var angle = m_Heading; * // var matrix = device3D.Transform.Value; * // matrix.Rotate(new Quaternion(axis, angle)); * // device3D.Transform = new MatrixTransform3D(matrix); * contentlayer.Children.Add(device3D); * }*/ public Robot3D(String robotname, ModelVisual3D _contentlayer) { robot3DInfo = new Robot3DInfo(); contentlayer = _contentlayer; device3D = new ModelVisual3D(); robot3DInfo.version = GlobalVariables.getPathRobot3DModel(); device3D.SetName(robotname); device3D.Content = Display3d(robot3DInfo.version); //device3D.Content =Display3d(robot3DInfo.modelPath); }
private void loadinform(String path) { try { BitmapImage bi = new BitmapImage(new Uri(TEXT_PATHMAP, UriKind.Absolute)); GlobalVariables.MAP_WIDTHPIXEL = bi.PixelWidth; GlobalVariables.MAP_HEIGHTPIXEL = bi.PixelHeight; double largesize = bi.PixelWidth <= bi.PixelHeight ? bi.PixelWidth : bi.PixelHeight; // select the small length of image //double largesize = 832; txt_gridwidth.Text = "" + largesize; txt_gridlength.Text = "" + largesize; txt_gridmajordistance.Text = "" + (largesize / 40.00).ToString("0.000"); txt_gridminordistance.Text = "" + (largesize / 40.00).ToString("0.000"); txt_borderX.Text = "" + GlobalVariables.MAP_WIDTHPIXEL; txt_borderY.Text = "" + GlobalVariables.MAP_HEIGHTPIXEL; GlobalVariables.GRIDLINE_WIDTH = Convert.ToDouble(txt_borderX.Text); GlobalVariables.GRIDLINE_LENGTH = Convert.ToDouble(txt_borderY.Text); GlobalVariables.MEASUREMENT_UNITASQUARE_LENGTH = largesize / 40; GlobalVariables.MEASUREMENT_UNITASQUARE_METER = Convert.ToDouble(txt_unitMeterPixel.Text) * GlobalVariables.MEASUREMENT_UNITASQUARE_LENGTH; txt_mappointX.Text = "" + GlobalVariables.MAP_WIDTHPIXEL; txt_mappointY.Text = "" + GlobalVariables.MAP_HEIGHTPIXEL; // txt_asquared.Text = "" + GlobalVariables.MEASUREMENT_UNITASQUARE+" (m)"; ModelImporter import = new ModelImporter(); Model3D device = import.Load(GlobalVariables.getPathRobot3DModel()); double Sx = device.Bounds.SizeX / 100; // size in cm to m //MessageBox.Show("size X:" +Sx); double Sy = device.Bounds.SizeY / 100; double Sz = device.Bounds.SizeZ / 100; GlobalVariables.ROBOT_SCALED = GlobalVariables.ConvertMetertoUnitLength(Sx / 100) / Sx; richtxt_detailInformation.Document.Blocks.Clear(); String inform = "Detail information: \n"; inform += "+Length of a square: " + GlobalVariables.MEASUREMENT_UNITASQUARE_LENGTH + "\n"; inform += "+Length meter of a squared: " + GlobalVariables.MEASUREMENT_UNITASQUARE_METER + "\n"; /// số ô là 40 , inform += "+ Robot size (m): " + Sx.ToString("0.00") + " // " + Sy.ToString("0.00") + " // " + Sz.ToString("0.00") + "\n"; inform += "+ Scaled Robot: " + GlobalVariables.ROBOT_SCALED.ToString("0.00"); richtxt_detailInformation.AppendText(inform); TEXT_ROBOT_INFOMATION = inform; } catch { MessageBox.Show("Path is wrong"); } }
public String findRobobt3Dmodel(String version) { // add more list model 3d Robot return(GlobalVariables.getPathRobot3DModel()); }