コード例 #1
0
 // Save the room.
 private void saveButton_Click(object sender, EventArgs e)
 {
     if (intersects)
     {
         SaveRoom sv = new SaveRoom();
         sv.ShowDialog();
         if (sv.DialogResult == DialogResult.OK)
         {
             room             = new Room();
             room.height      = sv.height;
             room.width       = sv.width;
             room.productList = new List <Product>();
             if (colorChosen)
             {
                 room.hexColor = Converter.ColorToHexString(chosenColor);
             }
             else
             {
                 room.floorType = chosenFloorType;
             }
             DatabaseController.AddLinesToDatabase(room, lines);
             mv.setDesignPanelRoom(room);
             mv.Controls.Remove(this);
         }
     }
 }
コード例 #2
0
        // Make graphicspath with lines from room.
        public GraphicsPath MakeGraphicsPath()
        {
            GraphicsPath gPath = new GraphicsPath();
            Room         room  = designPanel.rDesign;

            // If you used shapeselect, add lines to the room.

            if (designPanel.rDesign.shape == "Square")
            {
                if (room.lines.Count <= 0)
                {
                    room.lines.Add(new Line(standardSquareSize, standardSquareSize, standardSquareSize + room.width, standardSquareSize));
                    room.lines.Add(new Line(standardSquareSize + room.width, standardSquareSize, standardSquareSize + room.width, standardSquareSize + room.height));
                    room.lines.Add(new Line(standardSquareSize + room.width, standardSquareSize + room.height, standardSquareSize, standardSquareSize + room.height));
                    room.lines.Add(new Line(standardSquareSize, standardSquareSize + room.height, standardSquareSize, standardSquareSize));

                    DatabaseController.AddLinesToDatabase(room, room.lines);
                }
            }
            if (room.lines.Count > 0)
            {
                // Get corner values to draw in the center.
                SetLowestAndHighestValuesInCorners(room.lines);
                ChangeLinePositions(room.lines);
                // Redo this because line values changed.
                SetLowestAndHighestValuesInCorners(room.lines);
                calculateDifferenceBetweenCenters(room.lines);
                foreach (Line line in room.lines)
                {
                    gPath.AddLine(line.x1, line.y1, line.x2, line.y2);
                }
            }
            return(gPath);
        }