/// <summary> /// 判断到左右点设备都是On /// 就添加动画 /// 已经添加过则不会再重复添加 /// </summary> protected void AddAnimation() { if (startDrawObject == null || endDrawObject == null || !startDrawObject.IsOn || !endDrawObject.IsOn) { return; } if (animationList.Count > 0) { return; } //TODO 添加动画对象到animationList中 PointF[] points = new PointF[_pointArray.Count]; var point = _pointArray[0].P; for (int i = 0; i < _pointArray.Count; i++) { if (_pointArray[i].Pc == 'M') { point = _pointArray[i].P; } var pi = _pointArray[i].P; points[i] = new PointF(pi.X - point.X, pi.Y - point.Y); } PointF[] worldpoints = new PointF[_pointArray.Count]; for (int i = 0; i < _pointArray.Count; i++) { var pi = new PointF(_pointArray[i].P.X - 5, _pointArray[i].P.Y - 5); worldpoints[i] = pi; } AnimationPath path = new AnimationPath(points, worldpoints) { TimingAttr = { Dur = "10" } }; DrawCircleObject circle = new DrawCircleObject(-point.X, -point.Y, 10, 10) { }; circle.AnimationBases.Add(path); animationList.Add(circle); }
public static DrawObject CreateDrawObject(SVGUnit svge) { DrawObject o = null; switch (svge.getElementType()) { case SVGUnit.SVGUnitType.typeLine: o = DrawLineObject.Create((SVGLine)svge); break; case SVGUnit.SVGUnitType.typeRect: o = DrawRectangleObject.Create((SVGRect)svge); break; case SVGUnit.SVGUnitType.typeEllipse: o = DrawEllipseObject.Create((SVGEllipse)svge); break; case SVGUnit.SVGUnitType.typePolyline: o = DrawPolygonObject.Create((SVGPolyline)svge); break; case SVGUnit.SVGUnitType.typeImage: o = DrawImageObject.Create((SVGImage)svge); break; case SVGUnit.SVGUnitType.typeText: o = DrawTextObject.Create((SVGText)svge); break; case SVGUnit.SVGUnitType.typePath: o = DrawPathObject.Create((SVGPath)svge); break; case SVGUnit.SVGUnitType.typeCircle: o = DrawCircleObject.Create((SVGCircle)svge); break; default: break; } return(o); }