Ejemplo n.º 1
0
        private void LoadBase_Click(object sender, RoutedEventArgs e)
        {
            flag_base_model = true;
            double         H_floor = Convert.ToDouble(h_level_floor.Text);
            FloorplanModel m1      = new FloorplanModel();

            m1.Apartments = Model_Floor_1.Apartsments();
            m1.Points     = Model_Floor_1.Points();
            m1.Walls      = Model_Floor_1.Walls();
            double Door_w    = Convert.ToDouble(weightDoor.Text);
            double Window_w  = Convert.ToDouble(weightWindow.Text);
            double Door_h    = Convert.ToDouble(Door_he.Text);
            double Window_h  = Convert.ToDouble(h_Window.Text);
            double Window_l  = Convert.ToDouble(lev_Window.Text);
            double Location  = Convert.ToDouble(Location_O.Text);
            int    Col_Level = Convert.ToInt32(Col_level.Text);

            InfoSave = FileUtils.CreateData(
                m1,
                H_floor,
                Door_w,
                Window_w,
                Door_h,
                Window_h,
                Window_l,
                Location,
                Col_Level);
            RenderLines(m1);
            flagCount = true;
        }
Ejemplo n.º 2
0
        private void GenerOpening_Click(object sender, RoutedEventArgs e)
        {
            double H_floor   = Convert.ToDouble(h_level_floor.Text);
            double Door_w    = Convert.ToDouble(weightDoor.Text);
            double Window_w  = Convert.ToDouble(weightWindow.Text);
            double Door_h    = Convert.ToDouble(Door_he.Text);
            double Window_h  = Convert.ToDouble(h_Window.Text);
            double Window_l  = Convert.ToDouble(lev_Window.Text);
            double Location  = Convert.ToDouble(Location_O.Text);
            int    Col_Level = Convert.ToInt32(Col_level.Text);

            if (flag_base_model == true)
            {
                flag_doors_windows = true;
                FloorplanModel m1 = new FloorplanModel();
                m1.Apartments = Model_Floor_1.Apartsments();
                m1.Points     = Model_Floor_1.Points();
                m1.Walls      = Model_Floor_1.Walls();
                InfoSave      = FileUtils.CreateData(
                    m1,
                    H_floor,
                    Door_w,
                    Window_w,
                    Door_h,
                    Window_h,
                    Window_l,
                    Location,
                    Col_Level);
                RenderOpening(InfoSave);
            }
            else if (flag_custom_model == true && InputData != null)
            {
                InfoSave = FileUtils.CreateData(
                    InputData,
                    H_floor,
                    Door_w,
                    Window_w,
                    Door_h,
                    Window_h,
                    Window_l,
                    Location,
                    Col_Level);
                flag_doors_windows = true;
                RenderOpening(InfoSave);
                //CreateOpening(modelfloor);
            }
        }
Ejemplo n.º 3
0
        private async void Save_Click(object sender, RoutedEventArgs e)
        {
            SaveInfo InfoS = new SaveInfo();

            InfoS = InfoSave;

            progbar.Maximum = InfoS.MyMesh.Positions.Count + InfoS.MyMesh.TextureCoordinates.Count + InfoS.myWalls.Count;
            progbar.Value   = 0;

            Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
            dlg.FileName   = "FloorModel";
            dlg.DefaultExt = ".obj";
            dlg.Filter     = "3D model format (.obj)|*.obj";

            Nullable <bool> result = dlg.ShowDialog();

            if (result == true)
            {
                string filename = dlg.FileName;
                if (flag_base_model == true)
                {
                    FloorplanModel m1 = new FloorplanModel();
                    m1.Apartments = Model_Floor_1.Apartsments();
                    m1.Points     = Model_Floor_1.Points();
                    m1.Walls      = Model_Floor_1.Walls();

                    var progress = new Progress <double>(s => progbar.Value = s);

                    await FileUtils.CreateObj(filename, InfoS, progress);

                    //await Task.Factory.StartNew(
                    //                           () => FileUtils.CreateObj(filename, InfoS, progress),
                    //                           TaskCreationOptions.AttachedToParent);
                }
                else if (flag_custom_model == true)
                {
                    var progress = new Progress <double>(s => progbar.Value = s);

                    await Task.Factory.StartNew(
                        () => FileUtils.CreateObj(filename, InfoS, progress),
                        TaskCreationOptions.AttachedToParent);
                }
                MessageBox.Show(filename + "Модель успешно сохранена");
            }
        }