Skip to content

Commit

Permalink
Optimal code
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyendcn committed May 30, 2019
1 parent fad4df1 commit e707a8b
Show file tree
Hide file tree
Showing 26 changed files with 257 additions and 437 deletions.
Binary file modified .vs/slnx.sqlite
Binary file not shown.
Binary file modified KyThuatDoHoa_Nhom9/.vs/KyThuatDoHoa_Nhom9/v15/.suo
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
51 changes: 26 additions & 25 deletions KyThuatDoHoa_Nhom9/AboutBox1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion KyThuatDoHoa_Nhom9/AboutBox1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ partial class AboutBox1 : Form
public AboutBox1()
{
InitializeComponent();


this.labelVersion.Text = "Version: " + AssemblyVersion;
}

#region Assembly Attribute Accessors
Expand Down
25 changes: 13 additions & 12 deletions KyThuatDoHoa_Nhom9/Construct/_2DObject/HinhXe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@

namespace KyThuatDoHoa_Nhom9.Construct._2DObject
{
class HinhXe : INotifyPropertyChanged
public class HinhXe : INotifyPropertyChanged
{

// danh sách các points để vẽ hình xe
private Point[] lsPoint = new Point[25];
// bán kính bánh xe
private int bkBanh;
public Point[] LsPoint
{ get => lsPoint;
set
{
get => lsPoint;
set
{
lsPoint = value;
}
Expand All @@ -30,7 +31,7 @@ private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}



// khởi tạo các giá trị mặc định cho thuộc tính vẽ xe
Expand Down Expand Up @@ -82,7 +83,7 @@ public HinhXe()

}


public void drawCar(Graphics g)
{
// tô màu trước
Expand Down Expand Up @@ -158,12 +159,12 @@ public void drawCar(Graphics g)
tamTruoc3.ColorOfLine = Color.DarkRed;
tamTruoc3.Draw(g);
}
public void ToMau(Graphics g)
public void ToMau(Graphics g)
{
// Create solid brush.
SolidBrush brush = new SolidBrush(Color.Purple);
SolidBrush brush1 = new SolidBrush(Color.LawnGreen);
SolidBrush brush2 = new SolidBrush(Color.Orange);
SolidBrush brush2 = new SolidBrush(Color.Orange);
SolidBrush brush3 = new SolidBrush(Color.Chocolate);
// Create points that define polygon.
// tô màu bên ngoài
Expand All @@ -173,12 +174,12 @@ public void ToMau(Graphics g)
// tô màu hình chữ nhật
Point d1 = new Point(this.LsPoint[8].X, this.LsPoint[9].Y);
Point d2 = new Point(this.LsPoint[9].X, this.LsPoint[8].Y);
Point[] curvePoints1 = {this.LsPoint[8], d1, this.LsPoint[9], d2, this.LsPoint[8] };
Point[] curvePoints1 = { this.LsPoint[8], d1, this.LsPoint[9], d2, this.LsPoint[8] };

// tô màu hình tam giác
Point[] curvePoints2 = { this.LsPoint[10], this.LsPoint[11], this.LsPoint[12], this.LsPoint[10]};
Point[] curvePoints2 = { this.LsPoint[10], this.LsPoint[11], this.LsPoint[12], this.LsPoint[10] };



// Draw polygon to screen.
g.FillPolygon(brush, curvePoints);
g.FillPolygon(brush1, curvePoints1);
Expand Down Expand Up @@ -270,7 +271,7 @@ private Point nhanMT(double[,] matran, double[] mang)
}

// hàm tịnh tiến tọa đồ pn xDonVi, yDonVi
private void tinhTien( ref Point pn, int xDonVi, int yDonVi)
private void tinhTien(ref Point pn, int xDonVi, int yDonVi)
{
double[] matran1 = new double[3] { pn.X, pn.Y, 1 };
// khởi tạo ma trận tịnh tiến
Expand All @@ -289,7 +290,7 @@ private void doiXungOX(ref Point pn)
{ 0, 0, 1} };

pn = nhanMT(matran2, matran1);

}

private void doiXungOY(ref Point pn)
Expand Down
7 changes: 6 additions & 1 deletion KyThuatDoHoa_Nhom9/Construct/_2DObject/Timepiece.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ public class Timepiece : Shapes2DObject, INotifyPropertyChanged
}
}

public bool DisplayNow { get => displayNow; set => displayNow = value; }
public bool DisplayNow { get => displayNow;
set
{
OnPropertyChanged("nextStep");
}
}
public Clock Item_clock { get => item_clock;
set
{
Expand Down
2 changes: 1 addition & 1 deletion KyThuatDoHoa_Nhom9/Construct/_3DObject/HinhHopChuNhat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace KyThuatDoHoa_Nhom9.Construct._3DObject
{
class HinhHopChuNhat
public class HinhHopChuNhat
{
public int ChieuDai { get; set; }
public int ChieuRong { get; set; }
Expand Down
3 changes: 1 addition & 2 deletions KyThuatDoHoa_Nhom9/Construct/_3DObject/HinhTru.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@

namespace KyThuatDoHoa_Nhom9.Construct._3DObject
{
class HinhTru
public class HinhTru
{
private int _chieuCao;
public int ChieuCao { get; set; }
public int BanKinhDay { get; set; }
public int[,] TamDay { get; set; }
Expand Down
8 changes: 8 additions & 0 deletions KyThuatDoHoa_Nhom9/KyThuatDoHoa_Nhom9.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>
</StartupObject>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>icons8_Paint_Palette.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -288,6 +295,7 @@
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Content Include="icons8_Paint_Palette.ico" />
<Content Include="Note.txt" />
<None Include="Resources\61287020_371287316833461_49culo91464580271046656_n.jpg" />
<None Include="Resources\CỦ LOZ.jpg" />
Expand Down
1 change: 0 additions & 1 deletion KyThuatDoHoa_Nhom9/UI/UserCtr/TimepieceProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public partial class TimepieceProperties : UserControl, INotifyPropertyChanged
{
private Point mainLocation;
private ClockProperties _clockProperties;
private bool dispose;

public TimepieceProperties()
{
Expand Down
13 changes: 12 additions & 1 deletion KyThuatDoHoa_Nhom9/Variables/Globals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using KyThuatDoHoa_Nhom9.Construct._2DObject;
using KyThuatDoHoa_Nhom9.Construct._3DObject;
using KyThuatDoHoa_Nhom9.UI.UserCtr;
using KyThuatDoHoa_Nhom9.Variables;

namespace KyThuatDoHoa_Nhom9.Variables
Expand Down Expand Up @@ -43,6 +46,14 @@ public static class Globals
/// </summary>
public static Stack<Object> sObject_2D = new Stack<object>();


public static HinhXe hinhXe;
public static HinhTru hinhTru;
public static XeProperties xe;
public static HinhTruProperties hinhTruProperties;
public static HinhHopChuNhatProperties hinhHopChuNhatProperties;
public static HinhHopChuNhat hinhHopChuNhat;
public static bool flagXe;
public static Clock clock;
public static ClockProperties clockProperties;
}
}
Binary file modified KyThuatDoHoa_Nhom9/bin/Debug/KyThuatDoHoa_Nhom9.exe
Binary file not shown.
Binary file modified KyThuatDoHoa_Nhom9/bin/Debug/KyThuatDoHoa_Nhom9.pdb
Binary file not shown.
Loading

0 comments on commit e707a8b

Please sign in to comment.