Skip to content

Commit

Permalink
Finally, We did it..... 100%
Browse files Browse the repository at this point in the history
  • Loading branch information
PhongMax committed May 25, 2019
1 parent 08bcfde commit fad4df1
Show file tree
Hide file tree
Showing 22 changed files with 123 additions and 26 deletions.
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.
1 change: 1 addition & 0 deletions KyThuatDoHoa_Nhom9/Construct/_2DObject/Clock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public class Clock : Shapes2DObject, INotifyPropertyChanged
if(value != _r) //change
{
_r = value;
SetupClockwise(this.CurrentDatetime);
OnPropertyChanged("_r");
}
}
Expand Down
6 changes: 5 additions & 1 deletion KyThuatDoHoa_Nhom9/Construct/_2DObject/HinhChuNhat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ public void Rotate(Point p, double alpha)
}
public void Scale(SizeF scaleSize)
{
throw new NotImplementedException();
this.A = this.A.Scale(scaleSize.Width);
this.B = this.B.Scale(scaleSize.Width);
this.C = this.C.Scale(scaleSize.Width);
this.D = this.D.Scale(scaleSize.Width);

}

public void Shifting(int dx, int dy)
Expand Down
2 changes: 2 additions & 0 deletions KyThuatDoHoa_Nhom9/Construct/_2DObject/Timepiece.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ protected void OnPropertyChanged(string PropertyName)
public void Draw(Graphics g)
{
this.item_triangle.Draw(g, Color.Red);

this.item_rectangle.Draw(g, Color.Blue);
//this.item_rectangle.Scale(new SizeF(2, 2));
this.Item_clock.Draw(g);
this.Item_pendulum.Draw(g);

Expand Down
32 changes: 31 additions & 1 deletion KyThuatDoHoa_Nhom9/Construct/_2DObject/Transformations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,24 @@ public static Point ConvertToPoint(this double[] matrix)
return matrix;
}

private static double[,] SetUpForMatrixScale(this double[,] matrix, double x)
{
if (matrix.Length == 0 || matrix == null)
{
matrix = new double[3, 3] {
{ 1, 0, 0},
{ 0, 1, 0},
{ 0, 0, 1}
};
return matrix;
}

matrix[0, 0] = x; matrix[0, 1] = 0; matrix[0, 2] = 0;
matrix[1, 0] = 0; matrix[1, 1] = x; matrix[1, 2] = 0;
matrix[2, 0] = 0; matrix[2, 1] =0 ; matrix[2, 2] = 1;
return matrix;
}

/// <summary>
/// Matrix Translation To Original Coordinate
/// </summary>
Expand Down Expand Up @@ -170,6 +188,18 @@ public static Point Translate(this Point d1, int dx, int dy)

return p;
}


public static Point Scale(this Point d1, double x)
{
double[] arr = new double[3];
double[,] matrix = new double[3, 3];

arr = d1.ConvertToMatrix();
matrix = matrix.SetUpForMatrixScale(x);
Point p = GetNewPointByMulMatixs(matrix, arr);

return p;
}

}
}
3 changes: 2 additions & 1 deletion KyThuatDoHoa_Nhom9/Construct/_3DObject/HinhTru.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public void DrawElip(Graphics g)
Point point = ToaDo.NguoiDungMayTinh_3D(this.TamDay[2, 0], this.TamDay[2, 1], this.TamDay[2, 2]);
point = ToaDo.MayTinhNguoiDung_3D(point);

int b = this.BanKinhDay / 3 ;// (int)Math.Sqrt(Math.Abs(Math.Pow(this.BanKinhDay, 2) * Math.Pow(point.Y, 2)/(Math.Pow(this.BanKinhDay,2)-Math.Pow(point.X,2))));
double d = this.BanKinhDay * (Math.Sqrt(2) / 2);
int b = (int)d;// this.BanKinhDay / 3 ;// (int)Math.Sqrt(Math.Abs(Math.Pow(this.BanKinhDay, 2) * Math.Pow(point.Y, 2)/(Math.Pow(this.BanKinhDay,2)-Math.Pow(point.X,2))));
HinhElip hinhElip = new HinhElip(ToaDo.NguoiDungMayTinh_3D(this.TamDay[1, 0], this.TamDay[1, 1], this.TamDay[1, 2]), this.BanKinhDay, b,Color.Black);
hinhElip.NetDut(g);

Expand Down
26 changes: 26 additions & 0 deletions KyThuatDoHoa_Nhom9/UI/UserCtr/ClockProperties.Designer.cs

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

12 changes: 12 additions & 0 deletions KyThuatDoHoa_Nhom9/UI/UserCtr/ClockProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ private void btn_ChangeTime_Click(object sender, EventArgs e)

private void btn_Destroy_Click(object sender, EventArgs e)
{

this.Dispose();
OnPropertyChanged("Dispose");
}

private void btn_Hide_Click(object sender, EventArgs e)
Expand All @@ -84,6 +86,16 @@ private void button1_Click(object sender, EventArgs e)
this.Visible = false;
}

private void btn_ZoomIn_Click(object sender, EventArgs e)
{
OnPropertyChanged("ZoomIn");
}

private void btn_ZoomOut_Click(object sender, EventArgs e)
{
OnPropertyChanged("ZoomOut");
}

public event PropertyChangedEventHandler PropertyChanged;

protected void OnPropertyChanged(string PropertyName)
Expand Down

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

4 changes: 2 additions & 2 deletions KyThuatDoHoa_Nhom9/UI/UserCtr/HinhTruProperties.Designer.cs

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

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

2 changes: 1 addition & 1 deletion KyThuatDoHoa_Nhom9/UI/UserCtr/TimepieceProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public TimepieceProperties()

private void ClockProperties_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
OnPropertyChanged("timeChanged");
OnPropertyChanged(e.PropertyName);
}

public Point MainLocation { get => mainLocation;
Expand Down
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.
11 changes: 0 additions & 11 deletions KyThuatDoHoa_Nhom9/frm_Main.Designer.cs

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

44 changes: 38 additions & 6 deletions KyThuatDoHoa_Nhom9/frm_Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ private void Timepiece_PropertyChanged(object sender, PropertyChangedEventArgs e
}
private void TimepieceProperties_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName.Equals("timeChanged"))
if (e.PropertyName.Equals("currentTime"))
{
timepiece.Item_clock.CurrentDatetime = timepieceProperties.ClockProperties.CurrentTime;
}
Expand All @@ -491,6 +491,14 @@ private void TimepieceProperties_PropertyChanged(object sender, PropertyChangedE
this.timepiece = null;
this.timepieceProperties = null;
}
else if(e.PropertyName.Equals("ZoomIn"))
{
this.timepiece.Item_clock.R += 5;
}
else if(e.PropertyName.Equals("ZoomOut"))
{
this.timepiece.Item_clock.R -= 5;
}
}
#endregion
private void Xe_PropertyChanged(object sender, PropertyChangedEventArgs e)
Expand Down Expand Up @@ -525,15 +533,31 @@ private void Clock_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
this.picb_2DArea.Refresh();
}
clockProperties.CurrentTime = clock.CurrentDatetime;
clockProperties.HHours = clock.HHours;
clockProperties.HMinute = clock.HMinute;
clockProperties.HSecond = clock.HSecond;
if (clockProperties != null && clock != null)
{
clockProperties.CurrentTime = clock.CurrentDatetime;
clockProperties.HHours = clock.HHours;
clockProperties.HMinute = clock.HMinute;
clockProperties.HSecond = clock.HSecond;
}
}


private void ClockProperties_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName.Equals("ZoomIn"))
{
clock.R += 5;
}
else if(e.PropertyName.Equals("ZoomOut"))
{
clock.R -= 5;
}
else if(e.PropertyName.Equals("Dispose"))
{
clock = null;
return;
}
clock.CurrentDatetime = clockProperties.CurrentTime;
}
#endregion
Expand Down Expand Up @@ -852,7 +876,7 @@ private void Picb_3DArea_MouseMove(object sender, MouseEventArgs e)
{
Point p = e.Location;

label4.Text = p.ToString();


}

Expand Down Expand Up @@ -988,6 +1012,14 @@ private void lbl_LocationInGird_Click(object sender, EventArgs e)
{

}

private void button21_Click_1(object sender, EventArgs e)
{
if(clock != null)
{
clock.R = 30;
}
}
}


Expand Down
Binary file not shown.
Binary file modified KyThuatDoHoa_Nhom9/obj/Debug/KyThuatDoHoa_Nhom9.exe
Binary file not shown.
Binary file modified KyThuatDoHoa_Nhom9/obj/Debug/KyThuatDoHoa_Nhom9.pdb
Binary file not shown.

0 comments on commit fad4df1

Please sign in to comment.