Exemplo 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;
        }
Exemplo n.º 2
0
        private void RenderOpening(SaveInfo InfoSave)
        {
            List <MyLine> myRenderLines = InfoSave.myLines;

            for (int i = 0; i < myRenderLines.Count; i++)
            {
                Line myLine = new Line();

                if (InfoSave.myLines[i].Type == OpeningType.Door)
                {
                    myLine.Stroke = System.Windows.Media.Brushes.Brown;
                }
                else if (InfoSave.myLines[i].Type == OpeningType.Window)
                {
                    myLine.Stroke = System.Windows.Media.Brushes.Blue;
                }
                else if (InfoSave.myLines[i].Type == OpeningType.Entrance)
                {
                    myLine.Stroke = System.Windows.Media.Brushes.White;
                }
                else
                {
                    myLine.Stroke = System.Windows.Media.Brushes.Black;
                }

                myLine.StrokeThickness = 3;
                myLine.X1 = InfoSave.Points[myRenderLines[i].Start].X * 15;
                myLine.X2 = InfoSave.Points[myRenderLines[i].End].X * 15;
                myLine.Y1 = InfoSave.Points[myRenderLines[i].Start].Y * 15;
                myLine.Y2 = InfoSave.Points[myRenderLines[i].End].Y * 15;
                Canva1.Children.Add(myLine);
            }
        }
Exemplo n.º 3
0
 private void Clear_Click(object sender, RoutedEventArgs e)
 {
     Canva1.Children.Clear();
     flag_base_model    = false;
     flag_custom_model  = false;
     flag_doors_windows = false;
     InfoSave           = null;
     InputData          = null;
     flagCount          = false;
 }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 5
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 + "Модель успешно сохранена");
            }
        }
Exemplo n.º 6
0
        private void Load_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            // Set filter options and filter index.
            dlg.FileName   = "documetn";
            dlg.DefaultExt = ".txt";
            dlg.Filter     = "Text documents (.txt)|*.txt";

            // Call the ShowDialog method to show the dialog box.
            bool?userClickedOK = dlg.ShowDialog();

            // Process input if the user clicked OK.
            if (userClickedOK == true)
            {
                // Open the selected file to read.
                // Read the first line from the file and write it the textbox.
                string         filename   = dlg.FileName;
                FloorplanModel modelfloor = FileUtils.File_Read(filename);
                InputData = modelfloor;
                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);
                flag_custom_model = true;
                InfoSave          = FileUtils.CreateData(
                    InputData,
                    H_floor,
                    Door_w,
                    Window_w,
                    Door_h,
                    Window_h,
                    Window_l,
                    Location,
                    Col_Level);
                RenderLines(InputData);
                MessageBox.Show(filename + "Модель успешно загружена");
                flagCount = true;
            }
        }