5 using System.Collections;
6 using System.Collections.Generic;
7 using System.Diagnostics;
10 using System.Threading.Tasks;
12 using System.Windows.Input;
13 using System.Windows.Media;
14 using System.Windows.Shapes;
15 using System.Xml.Serialization;
21 [XmlRoot(ElementName =
"SVGRoot", Namespace =
"")]
24 [XmlElement(
"PathList")]
25 public List<gPath>
PathList =
new List<gPath>();
35 public List<gView>
shapeList =
new List<gView>();
36 public List<gPath>
FullList =
new List<gPath>();
183 for (i = tempPA.
currSate - 1; i >= 0; i--)
196 Debug.WriteLine(
"something wrong");
206 Debug.WriteLine(
"something wrong");
218 this.RedoStack.Clear();
240 public String
Text =
"";
242 public List<Point>
pList =
new List<Point>();
272 Boolean bfirst =
false;
339 private bool isdel =
false;
381 double gapX, gapY, x, y;
423 if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
465 foreach (Point p
in obj.pList)
476 public int Node = -1;
477 public System.Windows.Point
Point;
482 public System.Windows.Point
mouseXY;
484 public System.Windows.Point
point0;
485 public System.Windows.Point
point1;
486 public System.Windows.Point
point2;
487 public System.Windows.Point
point3;
531 for (
int i = l.Count - 1; i >= 0; i--)
533 if (drawType < 3 || drawType == 4)
535 if (l[i].controlBtn1 != gp.
point0)
537 if (l[i].controlBtn2 != gp.
point1)
539 if (l[i].controlBtn3 != gp.
point2)
541 if (l[i].controlBtn4 != gp.
point3)
546 if (l[i].drawtype != drawType)
548 if (l[i].controlBtn1 != gp.
point0)
550 if (l[i].controlBtn4 != gp.
point3)
563 System.Windows.Point center =
new System.Windows.Point(p.
point0.X + c_x, p.
point0.Y + c_y);
565 double simpleX = Math.Sqrt((1 - Math.Pow((p.
mouseXY.Y - center.Y), 2) / Math.Pow(c_y, 2)) * Math.Pow(c_x, 2));
566 double simpleY = Math.Sqrt((1 - Math.Pow((p.
mouseXY.X - center.X), 2) / Math.Pow(c_x, 2)) * Math.Pow(c_y, 2));
567 double higherPlaceX = center.X + simpleX;
568 double lowerPlaceX = center.X - simpleX;
569 double higherPlaceY = center.Y + simpleY;
570 double lowerPlaceY = center.Y - simpleY;
572 if (p.
mouseXY.X <= higherPlaceX && p.
mouseXY.X >= higherPlaceX - 3)
576 if (p.
mouseXY.Y <= higherPlaceY && p.
mouseXY.Y >= higherPlaceY - 3)
610 if (downPlace.X >= xm - 3 && downPlace.X <= xm + 3)
612 if (downPlace.Y >= ym - 3 && downPlace.Y <= ym + 3)
620 String[] tmpStr = Data.Split(
',');
621 double[] tmpDouStr =
new double[tmpStr.Length];
622 for (
int i = 0; i < tmpStr.Length; i++)
624 tmpDouStr[i] = Convert.ToDouble(tmpStr[i]);
626 System.Windows.Point tmpPoint0 =
new System.Windows.Point(tmpDouStr[0], tmpDouStr[1]);
627 System.Windows.Point tmpPoint1 =
new System.Windows.Point(tmpDouStr[2], tmpDouStr[3]);
628 System.Windows.Point tmpPoint2 =
new System.Windows.Point(tmpDouStr[4], tmpDouStr[5]);
629 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 去找,其實可以不用記錄