private DrawContainer Draw(List<Pair> data) { DrawContainer draw = new DrawContainer { Width = 700, Height = 700, Border = false }; this.angle = 0; this.start = 0; int total = 0; for (int i = 0; i < data.Count; i++) { total += (int)data[i].Second; } for (int i = 0; i < data.Count; i++) { this.Process(draw, i, data[i], total); } return draw; }
private bool ToggleModel(DrawContainer container, bool toggle) { foreach (var drawable in container.Drawables) { if (drawable is GenericModelRender) { var modelRenderer = ((GenericModelRender)drawable).Render; modelRenderer.SkeletonRender.Visibile = toggle; if (toggle) { string[] values = Enum.GetNames(typeof(Runtime.DebugRender)); UpdateDebugModes(values.ToList()); } //Hide automatically if there is no meshes to display to if (modelRenderer.Meshes.Count == 0 && toggle) { toggle = false; } } drawable.Visible = toggle; } return(toggle); }
private DrawContainer Draw(List <Pair> data) { DrawContainer draw = new DrawContainer { Width = 700, Height = 700, Border = false }; this.angle = 0; this.start = 0; int total = 0; for (int i = 0; i < data.Count; i++) { total += (int)data[i].Second; } for (int i = 0; i < data.Count; i++) { this.Process(draw, i, data[i], total); } return(draw); }
public GameController(MainWindow window) { unitFactory = UnitFactory.Instance; behaviourFactory = BehaviourFactory.Instance; moveContainer = new MoveContainer(); drawContainer = new DrawContainer(); units = new ArrayList(); this.window = window; timer = new Timer(); dispatcher = Dispatcher.CurrentDispatcher; currentLevel = new BaseLevelState(this); //maak level 1 aan currentLevel.NextLevel(); Crow.AddUnitToFactory(); Duck.AddUnitToFactory(); Unit unit1 = unitFactory.CreateUnit("Duck", moveContainer, drawContainer, behaviourFactory, window); units.Add(unit1); //Thread t = new Thread(new ThreadStart(gameLoop)); //t.Start(); Unit unit2 = unitFactory.CreateUnit("Crow", moveContainer, drawContainer, behaviourFactory, window); units.Add(unit2); t2 = new Thread(new ThreadStart(gameLoop)); t2.Start(); }
public void die(Unit unit) { MoveContainer.getInstance().Remove(unit); CollisionContainer.getInstance().Remove(unit); DrawContainer.getInstance().Remove(unit); UnitContainer.getInstance().Remove(unit); unit._currentRound.removeUnit(unit); }
internal void Visit(TimedTextDisplay timedTextDisplay, double delta) { timedTextDisplay.eleapsedTime += delta; if (timedTextDisplay.eleapsedTime >= timedTextDisplay.maxTime) { DrawContainer.getInstance().Remove(timedTextDisplay); MoveContainer.getInstance().Remove(timedTextDisplay); } }
public void subscribe() //Singleton anti-pattern :( { state = UnitStateFactory.Instance.create("unit-alive"); DrawContainer.getInstance().Add(this); MoveContainer.getInstance().Add(this); CollisionContainer.getInstance().Add(this); UnitContainer.getInstance().Add(this); _currentRound.registerUnit(this); }
public Unit CreateUnit(string name, MoveContainer mc, DrawContainer dc, BehaviourFactory bf, MainWindow window) { if (unitMap.ContainsKey(name)) { return unitMap[name].CreateInstance(mc, dc, bf, window); } throw new Exception("Unit with the name "+ name +" Not Found"); }
public TextDisplay(int x, int y, String text, Color c, int size) { this.text = text; this.size = size; this.y = y; this.x = x; this.color = c; DrawContainer.getInstance().Add(this); }
private void Process(DrawContainer draw, int i, Pair item, int total) { int value = (int)item.Second; double angleplus = 360 * value * 1.0 / total; double popangle = this.angle + (angleplus / 2); System.Drawing.Color color = this.ColorFromHSL(this.start, 0.5, 0.5); int delta = 30; System.Drawing.Color bcolor = this.ColorFromHSL(this.start, 1, 0.5); int r = 200; double rad = Math.PI / 180; draw.Gradients.Add(new LinearGradient { Degrees = 90, GradientID = "Grd" + i, Stops = { new GradientStop { Offset = 0, Color = System.Drawing.ColorTranslator.ToHtml(bcolor) }, new GradientStop { Offset = 100, Color = System.Drawing.ColorTranslator.ToHtml(color) } } }); AbstractSprite sector = this.Sector(250, 250, r, this.angle, this.angle + angleplus); sector.FillStyle = "url(#Grd" + i + ")"; sector.StrokeStyle = "#fff"; sector.LineWidth = 3; draw.Items.Add(sector); TextSprite text = new TextSprite { SpriteID = "text" + i, X = Convert.ToInt32(350 + (r + delta + 55) * Math.Cos(-popangle * rad)), Y = Convert.ToInt32(350 + (r + delta + 25) * Math.Sin(-popangle * rad)), Text = item.First.ToString(), FillStyle = System.Drawing.ColorTranslator.ToHtml(bcolor), StrokeStyle = "none", GlobalAlpha = 0, FontSize = "20" }; draw.Items.Add(text); //sector.Listeners.MouseOver.Handler = string.Format("onMouseOver(this, {0});", i); //sector.Listeners.MouseOut.Handler = string.Format("onMouseOut(this, {0});", i); this.angle += angleplus; this.start += 0.1; }
public ActionResult ChangeColor(string button) { DrawContainer dc = this.GetCmp <DrawContainer>("Draw1"); dc.GetSprite("Sprite1").SetAttributes(new Sprite { FillStyle = "red" }); dc.RenderFrame(); return(this.Direct()); }
public ActionResult RotateLeft(string button) { DrawContainer dc = this.GetCmp <DrawContainer>("Draw1"); dc.GetSprite("Sprite1").SetAttributes(new Sprite { RotationDegrees = -45 }); dc.RenderFrame(); return(this.Direct()); }
public ActionResult Scaling(string button) { DrawContainer dc = this.GetCmp <DrawContainer>("Draw1"); dc.GetSprite("Sprite1").SetAttributes(new Sprite { ScalingX = 2, ScalingY = 2, Duration = 0 }); dc.RenderFrame(); return(this.Direct()); }
public ActionResult Translation(string button) { DrawContainer dc = this.GetCmp <DrawContainer>("Draw1"); dc.GetSprite("Sprite1").SetAttributes(new Sprite { TranslationX = -100, TranslationY = -100 }); dc.RenderFrame(); return(this.Direct()); }
public Duck(MoveContainer mc, DrawContainer dc, BehaviourFactory bf, MainWindow window) : base(mc, dc, bf, window) { //rnd = new Random(); size = 40; x = 0; y = rnd.Next(26, 300); color = Brushes.PowderBlue; velocity = 1.0F; heading = 1.5F; InitUnit(); }
public ActionResult AnimateRect() { DrawContainer dc = X.GetCmp <DrawContainer>("Draw1"); dc.GetSprite("rectangles").SetAttributes(new Sprite { Duration = 1000, TranslationX = 150 }); dc.RenderFrame(); return(this.Direct()); }
public ActionResult RotateRight(string button) { DrawContainer dc = this.GetCmp <DrawContainer>("Draw1"); dc.GetSprite("Sprite1").SetAttributes(new Sprite { Duration = 1000, RotationDegrees = 0, Easing = Easing.ElasticIn }); dc.RenderFrame(); return(this.Direct()); }
public Unit(MoveContainer mc, DrawContainer dc, BehaviourFactory bf, MainWindow window) { moveContainer = mc; drawContainer = dc; behaviourFactory = bf; this.window = window; moveBehaviour = behaviourFactory.CreateMoveBehaviour(this, "flying"); drawBehaviour = behaviourFactory.CreateDrawBehaviour(this, "flying"); moveContainer.Add(moveBehaviour); drawContainer.Add(drawBehaviour); this.window = window; dispatcher = Dispatcher.CurrentDispatcher; }
private void Process(DrawContainer draw, int i, Pair item, int total) { int value = (int)item.Second; double angleplus = 360 * value * 1.0 / total; double popangle = this.angle + (angleplus / 2); System.Drawing.Color color = this.ColorFromHSL(this.start, 0.5, 0.5); int delta = 30; System.Drawing.Color bcolor = this.ColorFromHSL(this.start, 1, 0.5); int r = 200; double rad = Math.PI / 180; draw.Gradients.Add(new LinearGradient { Degrees = 90, GradientID = "Grd" + i, Stops = { new GradientStop{Offset = 0, Color = System.Drawing.ColorTranslator.ToHtml(bcolor)}, new GradientStop{Offset = 100, Color = System.Drawing.ColorTranslator.ToHtml(color)} } }); AbstractSprite sector = this.Sector(250, 250, r, this.angle, this.angle + angleplus); sector.FillStyle = "url(#Grd" + i + ")"; sector.StrokeStyle = "#fff"; sector.LineWidth = 3; draw.Items.Add(sector); TextSprite text = new TextSprite { SpriteID = "text" + i, X = Convert.ToInt32(350 + (r + delta + 55) * Math.Cos(-popangle * rad)), Y = Convert.ToInt32(350 + (r + delta + 25) * Math.Sin(-popangle * rad)), Text = item.First.ToString(), FillStyle = System.Drawing.ColorTranslator.ToHtml(bcolor), StrokeStyle = "none", GlobalAlpha = 0, FontSize = "20" }; draw.Items.Add(text); //sector.Listeners.MouseOver.Handler = string.Format("onMouseOver(this, {0});", i); //sector.Listeners.MouseOut.Handler = string.Format("onMouseOut(this, {0});", i); this.angle += angleplus; this.start += 0.1; }
public Crow(MoveContainer mc, DrawContainer dc, BehaviourFactory bf, MainWindow window) : base(mc, dc, bf, window) { //rnd = new Random(); size = 40; x = 0; y = rnd.Next(26, 300); color = Brushes.Black; velocity = 1.0F; heading = 1.5F; this.window = window; dispatcher = Dispatcher.CurrentDispatcher; InitUnit(); }
public void LoadModelFormat(IModelSceneFormat resourceFormat) { var resource = resourceFormat.ToGeneric(); if (ResourceFormats.Contains(resourceFormat)) { activeModelCB.SelectedItem = resource.Name; return; } ResourceFormats.Add(resourceFormat); var container = new ModelContainer(); container.AddModel(resourceFormat); Runtime.ModelContainers.Add(container); ModelContainers.Add(container); var drawableContainer = new DrawContainer(); drawableContainer.Name = resource.Name; var drawable = new GenericModelRender(resourceFormat.Renderer); drawableContainer.Drawables.Add(drawable); foreach (var model in resource.Models) { var skeleton = new GenericSkeletonRenderer(model.Skeleton); drawableContainer.Drawables.Add(skeleton); } Containers.Add(drawableContainer); if (Viewport3D.Scene != null) { ReloadScene(); } activeModelCB.Items.Add(resource.Name); activeModelCB.SelectedItem = resource.Name; }
private DrawContainer Draw(List<string> axisx, List<Pair> data) { DrawContainer draw = new DrawContainer { Border = false }; int width = 800; int height = 300; int leftgutter = 30; int bottomgutter = 20; int x = Convert.ToInt32((width - leftgutter) * 1.0 / axisx.Count); int y = Convert.ToInt32((height - bottomgutter) * 1.0 / data.Count); int max = Convert.ToInt32(Math.Round(x / 2.0) - 1); for (int i = 0; i < axisx.Count; i++) { draw.Items.Add(new TextSprite { X = Convert.ToInt32(leftgutter + x * (i + 0.5)), Y = 294, Text = axisx[i], Font = "10px Fontin-Sans, Arial", StrokeStyle = "none", FillStyle = "#000" }); } for (int i = 0; i < data.Count; i++) { draw.Items.Add(new TextSprite { X = 10, Y = Convert.ToInt32(y * (i + 0.5)), Text = data[i].First.ToString(), Font = "10px Fontin-Sans, Arial", StrokeStyle = "none", FillStyle = "#000" }); } for (int i = 0; i < data.Count; i++) { for (int j = 0; j < axisx.Count; j++) { List<int?> row = (List<int?>)data[i].Second; int? value = row[j]; if (value != null) { int r = Convert.ToInt32(Math.Min(Math.Round(Math.Sqrt(value.Value / Math.PI) * 4), max)); int dx = Convert.ToInt32(leftgutter + x * (j + 0.5) - 60 - r); int dy = Convert.ToInt32(y * (i + 0.5) - 10); string color = System.Drawing.ColorTranslator.ToHtml(ColorFromAhsb((1 - r * 1.0f / max) * 0.5, 1, 0.5)); draw.Items.Add(new CircleSprite { SpriteID = "dt_" + i + "_" + j, CX = dx + 60 + r, CY = dy + 10, Radius = r, StrokeStyle = "none", FillStyle = color }); if (r < 6) { draw.Items.Add(new CircleSprite { SpriteID = "bg_" + i + "_" + j, CX = dx + 60 + r, CY = dy + 10, Radius = 6, StrokeStyle = "2", FillStyle = "#777", GlobalAlpha = 0.5, Hidden = true }); } draw.Items.Add(new TextSprite { SpriteID = "lbl_" + i + "_" + j, X = dx + 60 + r, Y = dy + 10, TextAlign = TextSpriteAlign.Center, Text = value.Value.ToString(), Font = "10px Fontin-Sans, Arial", StrokeStyle = "none", FillStyle = "#fff", Hidden = true }); draw.Items.Add(new CircleSprite { CX = dx + 60 + r, CY = dy + 10, Radius = max, StrokeStyle = "none", FillStyle = "#000", GlobalAlpha = 0/*, Listeners = { MouseOver = { Handler = string.Format("onMouseOver(this.surface, {0});", JSON.Serialize("_"+i+"_"+j)) }, MouseOut = { Handler = string.Format("onMouseOut(this.surface, {0});", JSON.Serialize("_"+i+"_"+j)) } }*/ }); } } } draw.Width = width; draw.Height = height; return draw; }
void bw_ProgressChanged(object sender, ProgressChangedEventArgs e) { DrawContainer.getInstance().Draw(canvas, delta); }
private DrawContainer Draw(List <int> labels, List <int> data) { DrawContainer draw = new DrawContainer { ID = "Draw1", Border = false }; int width = 800; int height = 250; int leftgutter = 30; int bottomgutter = 20; int topgutter = 20; double colorhue = 0.6; string color = System.Drawing.ColorTranslator.ToHtml(this.ColorFromHSB(colorhue, 0.5, 0.5)); double x = (width - leftgutter) / (labels.Count * 1.0); int max = data.Max(); double y = (height - bottomgutter - topgutter) / (max * 1.0); draw.Items.Add(this.GridPath(leftgutter + y * 0.5 + 0.5, topgutter + 0.5, width - leftgutter - x, height - topgutter - bottomgutter, 10, 10, "#000")); PathSprite pathSprite = new PathSprite { StrokeStyle = color, LineWidth = 4, Linejoin = StrokeLinejoin.Round }; draw.Items.Add(pathSprite); PathSprite bgpSprite = new PathSprite { StrokeStyle = "none", GlobalAlpha = 0.3, FillStyle = color }; draw.Items.Add(bgpSprite); List <string> p = new List <string>(); List <string> bgpp = new List <string>(); for (int i = 0; i < labels.Count; i++) { int yc = Convert.ToInt32(Math.Round(height - bottomgutter - y * data[i])); int xc = Convert.ToInt32(Math.Round(leftgutter - 10 + x * (i + 0.5))); int heightCraph = height - bottomgutter; draw.Items.Add(new TextSprite { X = Convert.ToInt32(xc), Y = height - 6, Text = labels[i].ToString(), FillStyle = "#000", Font = "12px Helvetica, Arial" }); if (i == 0) { p.AddRange(new string[] { "M", JSON.Serialize(xc), JSON.Serialize(yc), "C", JSON.Serialize(xc), JSON.Serialize(yc) }); bgpp.AddRange(new string[] { "M", JSON.Serialize(leftgutter - 10 + x * 0.5), JSON.Serialize(height - bottomgutter), "L", JSON.Serialize(xc), JSON.Serialize(yc), "C", JSON.Serialize(xc), JSON.Serialize(yc) }); } if (i > 0 && i < (labels.Count - 1)) { double Y0 = Math.Round(height - bottomgutter - y * data[i - 1]); double X0 = Math.Round(leftgutter + x * (i - 0.5)); double Y2 = Math.Round(height - bottomgutter - y * data[i + 1]); double X2 = Math.Round(leftgutter + x * (i + 1.5)); double[] a = this.GetAnchors(X0, Y0, xc, yc, X2, Y2); p.AddRange(new string[] { JSON.Serialize(a[0]), JSON.Serialize(a[1]), JSON.Serialize(xc), JSON.Serialize(yc), JSON.Serialize(a[2]), JSON.Serialize(a[3]) }); bgpp.AddRange(new string[] { JSON.Serialize(a[0]), JSON.Serialize(a[1]), JSON.Serialize(xc), JSON.Serialize(yc), JSON.Serialize(a[2]), JSON.Serialize(a[3]) }); } draw.Items.Add(new CircleSprite { SpriteID = "dot_" + i, CX = Convert.ToInt32(xc), CY = Convert.ToInt32(yc), Radius = 4, FillStyle = "#333", StrokeStyle = color, LineWidth = 2 }); AbstractSprite rect = new RectSprite { X = Convert.ToInt32(leftgutter + x * i), Y = 0, Width = Convert.ToInt32(xc), Height = heightCraph, StrokeStyle = "none", FillStyle = "#fff", GlobalAlpha = 0 }; //rect.Listeners.MouseOver.Handler = string.Format("onMouseOver(this, {0}, {1}, {2});", data[i], labels[i], i); //rect.Listeners.MouseOut.Handler = string.Format("onMouseOut(this, {0});", i); draw.Items.Add(rect); if (i == (labels.Count - 1)) { p.AddRange(new string[] { JSON.Serialize(xc), JSON.Serialize(yc), JSON.Serialize(xc), JSON.Serialize(yc) }); bgpp.AddRange(new string[] { JSON.Serialize(xc), JSON.Serialize(yc), JSON.Serialize(xc), JSON.Serialize(yc), "L", JSON.Serialize(xc), JSON.Serialize(height - bottomgutter), "z" }); pathSprite.Path = string.Join(" ", p); bgpSprite.Path = string.Join(" ", bgpp); } } draw.Width = width; draw.Height = height; return(draw); }
public override void InCString(DrawContainer dc) { throw new NotImplementedException(); }
public override void InCString(DrawContainer dc) { for (int stufe = 0; stufe < Stufen; stufe++) { dc.addWort("Stufe " + (stufe + 1) + ": "); if (Talente[stufe] != null) foreach (var t in Talente[stufe]) { dc.addWort(t != null ? t.SchreibName : "LEER"); dc.addWort(", "); } if (FreieTalente[stufe] != null) foreach (var t in FreieTalente[stufe]) { dc.addWort(t != null ? t.SchreibName : "LEER"); dc.addWort(", "); } dc.addAbsatz(); } }
public override void InCString(DrawContainer dc) { FertigkeitsSummen.Last().IntoText(dc); }
public abstract Unit CreateInstance(MoveContainer mc, DrawContainer dc, BehaviourFactory bf, MainWindow window);
private DrawContainer Draw(List <string> axisx, List <Pair> data) { DrawContainer draw = new DrawContainer { Border = false }; int width = 800; int height = 300; int leftgutter = 30; int bottomgutter = 20; int x = Convert.ToInt32((width - leftgutter) * 1.0 / axisx.Count); int y = Convert.ToInt32((height - bottomgutter) * 1.0 / data.Count); int max = Convert.ToInt32(Math.Round(x / 2.0) - 1); for (int i = 0; i < axisx.Count; i++) { draw.Items.Add(new TextSprite { X = Convert.ToInt32(leftgutter + x * (i + 0.5)), Y = 294, Text = axisx[i], Font = "10px Fontin-Sans, Arial", StrokeStyle = "none", FillStyle = "#000" }); } for (int i = 0; i < data.Count; i++) { draw.Items.Add(new TextSprite { X = 10, Y = Convert.ToInt32(y * (i + 0.5)), Text = data[i].First.ToString(), Font = "10px Fontin-Sans, Arial", StrokeStyle = "none", FillStyle = "#000" }); } for (int i = 0; i < data.Count; i++) { for (int j = 0; j < axisx.Count; j++) { List <int?> row = (List <int?>)data[i].Second; int? value = row[j]; if (value != null) { int r = Convert.ToInt32(Math.Min(Math.Round(Math.Sqrt(value.Value / Math.PI) * 4), max)); int dx = Convert.ToInt32(leftgutter + x * (j + 0.5) - 60 - r); int dy = Convert.ToInt32(y * (i + 0.5) - 10); string color = System.Drawing.ColorTranslator.ToHtml(ColorFromAhsb((1 - r * 1.0f / max) * 0.5, 1, 0.5)); draw.Items.Add(new CircleSprite { SpriteID = "dt_" + i + "_" + j, CX = dx + 60 + r, CY = dy + 10, Radius = r, StrokeStyle = "none", FillStyle = color }); if (r < 6) { draw.Items.Add(new CircleSprite { SpriteID = "bg_" + i + "_" + j, CX = dx + 60 + r, CY = dy + 10, Radius = 6, StrokeStyle = "2", FillStyle = "#777", GlobalAlpha = 0.5, Hidden = true }); } draw.Items.Add(new TextSprite { SpriteID = "lbl_" + i + "_" + j, X = dx + 60 + r, Y = dy + 10, TextAlign = TextSpriteAlign.Center, Text = value.Value.ToString(), Font = "10px Fontin-Sans, Arial", StrokeStyle = "none", FillStyle = "#fff", Hidden = true }); draw.Items.Add(new CircleSprite { CX = dx + 60 + r, CY = dy + 10, Radius = max, StrokeStyle = "none", FillStyle = "#000", GlobalAlpha = 0/*, * Listeners = * { * MouseOver = { * Handler = string.Format("onMouseOver(this.surface, {0});", JSON.Serialize("_"+i+"_"+j)) * }, * * MouseOut = { * Handler = string.Format("onMouseOut(this.surface, {0});", JSON.Serialize("_"+i+"_"+j)) * } * }*/ }); } } } draw.Width = width; draw.Height = height; return(draw); }
public override void InCString(DrawContainer dc) { foreach (var item in Names) dc.addWort(item + " "); dc.addAbsatz(); dc.addWort(Mann ? "männlich" : "weiblich"); dc.addWort(", " + Alter + " Jahre alt"); dc.addAbsatz(); dc.addWort("*" + Geburtstag.ToString("dd.MM.yyyy") + ", " + Geburtsort); }
void Awake() { mDrawContainer = new DrawContainer(gameObject, panel, uicamera); }
public override void InCString(DrawContainer dc) { dc.addWort("Rasse: "); dc.addWort(Rasse != null ? Rasse.SchreibName : "keine Rasse"); dc.addAbsatz(); dc.addWort("Bachelorklasse: "); dc.addWort(Bachelor != null ? Bachelor.SchreibName : "keine Bachelorklasse"); dc.addAbsatz(); dc.addWort("Masterklasse: "); dc.addWort(Master != null ? Master.SchreibName : "keine Masterklasse"); }
public override Unit CreateInstance(MoveContainer mc, DrawContainer dc, BehaviourFactory bf, MainWindow window) { return new Duck(mc, dc, bf, window); }
public override void InCString(DrawContainer dc) { Attribute.IntoText(dc); }
private DrawContainer Draw(List<int> labels, List<int> data) { DrawContainer draw = new DrawContainer { ID = "Draw1", Border = false }; int width = 800; int height = 250; int leftgutter = 30; int bottomgutter = 20; int topgutter = 20; double colorhue = 0.6; string color = System.Drawing.ColorTranslator.ToHtml(this.ColorFromHSB(colorhue, 0.5, 0.5)); double x = (width - leftgutter) / (labels.Count * 1.0); int max = data.Max(); double y = (height - bottomgutter - topgutter) / (max * 1.0); draw.Items.Add(this.GridPath(leftgutter + y * 0.5 + 0.5, topgutter + 0.5, width - leftgutter - x, height - topgutter - bottomgutter, 10, 10, "#000")); PathSprite pathSprite = new PathSprite { StrokeStyle = color, LineWidth = 4, Linejoin = StrokeLinejoin.Round }; draw.Items.Add(pathSprite); PathSprite bgpSprite = new PathSprite { StrokeStyle = "none", GlobalAlpha = 0.3, FillStyle = color }; draw.Items.Add(bgpSprite); List<string> p = new List<string>(); List<string> bgpp = new List<string>(); for (int i = 0; i < labels.Count; i++) { int yc = Convert.ToInt32(Math.Round(height - bottomgutter - y * data[i])); int xc = Convert.ToInt32(Math.Round(leftgutter - 10 + x * (i + 0.5))); int heightCraph = height - bottomgutter; draw.Items.Add(new TextSprite { X = Convert.ToInt32(xc), Y = height - 6, Text = labels[i].ToString(), FillStyle = "#000", Font = "12px Helvetica, Arial" }); if (i == 0) { p.AddRange(new string[]{"M", JSON.Serialize(xc), JSON.Serialize(yc), "C", JSON.Serialize(xc), JSON.Serialize(yc)}); bgpp.AddRange(new string[]{"M", JSON.Serialize(leftgutter - 10 + x * 0.5), JSON.Serialize(height - bottomgutter), "L", JSON.Serialize(xc), JSON.Serialize(yc), "C", JSON.Serialize(xc), JSON.Serialize(yc)}); } if (i > 0 && i < (labels.Count - 1)) { double Y0 = Math.Round(height - bottomgutter - y * data[i - 1]); double X0 = Math.Round(leftgutter + x * (i - 0.5)); double Y2 = Math.Round(height - bottomgutter - y * data[i + 1]); double X2 = Math.Round(leftgutter + x * (i + 1.5)); double[] a = this.GetAnchors(X0, Y0, xc, yc, X2, Y2); p.AddRange(new string[] { JSON.Serialize(a[0]), JSON.Serialize(a[1]), JSON.Serialize(xc), JSON.Serialize(yc), JSON.Serialize(a[2]), JSON.Serialize(a[3]) }); bgpp.AddRange(new string[] { JSON.Serialize(a[0]), JSON.Serialize(a[1]), JSON.Serialize(xc), JSON.Serialize(yc), JSON.Serialize(a[2]), JSON.Serialize(a[3]) }); } draw.Items.Add(new CircleSprite { SpriteID = "dot_" + i, CX = Convert.ToInt32(xc), CY = Convert.ToInt32(yc), Radius = 4, FillStyle = "#333", StrokeStyle = color, LineWidth = 2 }); AbstractSprite rect = new RectSprite { X = Convert.ToInt32(leftgutter + x * i), Y = 0, Width = Convert.ToInt32(xc), Height = heightCraph, StrokeStyle = "none", FillStyle = "#fff", GlobalAlpha = 0 }; //rect.Listeners.MouseOver.Handler = string.Format("onMouseOver(this, {0}, {1}, {2});", data[i], labels[i], i); //rect.Listeners.MouseOut.Handler = string.Format("onMouseOut(this, {0});", i); draw.Items.Add(rect); if (i == (labels.Count - 1)) { p.AddRange(new string[] { JSON.Serialize(xc), JSON.Serialize(yc), JSON.Serialize(xc), JSON.Serialize(yc) }); bgpp.AddRange(new string[] { JSON.Serialize(xc), JSON.Serialize(yc), JSON.Serialize(xc), JSON.Serialize(yc), "L", JSON.Serialize(xc), JSON.Serialize(height - bottomgutter), "z" }); pathSprite.Path = string.Join(" ", p); bgpSprite.Path = string.Join(" ", bgpp); } } draw.Width = width; draw.Height = height; return draw; }
public abstract void InCString(DrawContainer dc);