5 using System.Collections;
6 using System.Collections.Generic;
7 using System.Diagnostics;
10 using System.Threading.Tasks;
14 using System.Windows.Input;
15 using System.Windows.Media;
16 using System.Windows.Shapes;
17 using System.Xml.Serialization;
26 [XmlRoot(ElementName =
"SVGRoot", Namespace =
"")]
29 [XmlElement(
"PathList")]
30 public List<gPath>
PathList =
new List<gPath>();
41 public List<gPath>
FullList =
new List<gPath>();
198 for (i = tempPA.
currSate - 1; i >= 0; i--)
211 Debug.WriteLine(
"something wrong");
221 Debug.WriteLine(
"something wrong");
235 this.RedoStack.Clear();
259 public List<Point>
pList =
new List<Point>();
289 Boolean bfirst =
false;
398 double gapX, gapY, x, y;
442 if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
484 foreach (Point p
in obj.pList)
558 for (
int i = l.Count - 1; i >= 0; i--)
560 if (drawType < 3 || drawType == 4)
562 if (l[i].controlBtn1 != gp.
point0)
564 if (l[i].controlBtn2 != gp.
point1)
566 if (l[i].controlBtn3 != gp.
point2)
568 if (l[i].controlBtn4 != gp.
point3)
573 if (l[i].drawtype != drawType)
575 if (l[i].controlBtn1 != gp.
point0)
577 if (l[i].controlBtn4 != gp.
point3)
590 System.Windows.Point center =
new System.Windows.Point(p.
point0.X + c_x, p.
point0.Y + c_y);
592 double simpleX = Math.Sqrt((1 - Math.Pow((p.
mouseXY.Y - center.Y), 2) / Math.Pow(c_y, 2)) * Math.Pow(c_x, 2));
593 double simpleY = Math.Sqrt((1 - Math.Pow((p.
mouseXY.X - center.X), 2) / Math.Pow(c_x, 2)) * Math.Pow(c_y, 2));
594 double higherPlaceX = center.X + simpleX;
595 double lowerPlaceX = center.X - simpleX;
596 double higherPlaceY = center.Y + simpleY;
597 double lowerPlaceY = center.Y - simpleY;
599 if (p.
mouseXY.X <= higherPlaceX && p.
mouseXY.X >= higherPlaceX - 3)
603 if (p.
mouseXY.Y <= higherPlaceY && p.
mouseXY.Y >= higherPlaceY - 3)
637 if (downPlace.X >= xm - 3 && downPlace.X <= xm + 3)
639 if (downPlace.Y >= ym - 3 && downPlace.Y <= ym + 3)
647 String[] tmpStr = Data.Split(
',');
648 double[] tmpDouStr =
new double[tmpStr.Length];
649 for (
int i = 0; i < tmpStr.Length; i++)
651 tmpDouStr[i] = Convert.ToDouble(tmpStr[i]);
653 System.Windows.Point tmpPoint0 =
new System.Windows.Point(tmpDouStr[0], tmpDouStr[1]);
654 System.Windows.Point tmpPoint1 =
new System.Windows.Point(tmpDouStr[2], tmpDouStr[3]);
655 System.Windows.Point tmpPoint2 =
new System.Windows.Point(tmpDouStr[4], tmpDouStr[5]);
656 System.Windows.Point tmpPoint3 =
new System.Windows.Point(tmpDouStr[6], tmpDouStr[7]);
System.Windows.Point point3
List< gPath > multiSelList
System.Windows.Point controlBtn3
bool checkHitCenter(System.Windows.Point downPlace, gPath p)
int checkHitWhich(List< gPath > l, gPoint gp, int drawType)
System.Windows.Point Point
System.Windows.Point point1
System.Windows.Point point0
System.Windows.Point point2
void writeIn(gPath Data, int Action)
維護 undo stack ,把目前狀態存起來.並清空redo stack,如果之前有undo 動作,是回覆到某一狀態,在此之後的動作都可清除
System.Windows.Point controlBtn4
bool checkHitLine(System.Windows.Point downPlace, gPath p)
void myLine_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
System.Windows.Point controlBtn2
int Action
0: insert, 1:update, 2:delete
void myLine_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
為了維護undo redo, 系統任何操作必需把狀態存起來,
void redraw(int removetype)
int GraphIndex
目前圖形串列中的第幾個,為必免順序改變,凡加入的就一直存在(data list)
記錄shape list,action data stack 記錄動作,每個動作(pointAry)包含,該圖是圖形的第幾個(Listplace),之前記錄是否己有相同圖是第幾個,...
System.Windows.Point mouseXY
static IList< ShapeObj > SupportedShape(getForm myview)
define supported shape
bool checkHitCurve(String Data, gPath p)
System.Windows.Point controlBtn1
bool checkHitEllipse(gPoint p)
bool checkHitRect(gPoint p)
void myLine_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
saveState(int a, int b, int c)
int checkHitCorner(System.Windows.Point downPlace, gPath p)
List< Shape > controlShape
int currSate
操作前的狀態 fullList 中,操作前該物件所在位置,即最後一個狀態.至少會有新增的狀態.以GraphIndex 去找,其實可以不用記錄