protected AbstractCsg(IShape left, IShape right) { Left = left; Right = right; left.Parent = this; right.Parent = this; Shapes.Add(Left); Shapes.Add(Right); }
public void Add(params IShape[] shapes) { box = null; foreach (var shape in shapes) { Shapes.Add(shape); shape.Parent = this; } }
private void SendNextShape() { int randomIndex = random.Next(this.SelectionShapes.Count); IShape shape = this.SelectionShapes[randomIndex].CreatePart().ExportedValue; shape.ReachedBottom += shape_ReachedBottom; Shapes.Add(shape); ActiveShape = shape; }
///<summary> /// Constructs a wrapped shape. /// A constructor is also available which takes a list of objects rather than just a pair. /// The shape will be recentered. ///</summary> ///<param name="firstShape">First shape in the wrapped shape.</param> ///<param name="secondShape">Second shape in the wrapped shape.</param> ///<param name="center">Center of the shape before recentering..</param> public WrappedShape(ConvexShapeEntry firstShape, ConvexShapeEntry secondShape, out Vector3 center) { Shapes.Add(firstShape); Shapes.Add(secondShape); UpdateConvexShapeInfo(out center); Shapes.Changed += ShapesChanged; }
public void AddEllipse() { var newEllipse = new DnaEllipse(tool); newEllipse.Init(); Shapes.Add(newEllipse); SetDirty(); }
public void AddCircle() { var newCircle = new DnaCircle(tool); newCircle.Init(); Shapes.Add(newCircle); SetDirty(); }
public void AddPolygon() { var newPolygon = new DnaPolygon(tool); newPolygon.Init(); Shapes.Add(newPolygon); SetDirty(); }
public override void CreateShapes() { Shapes.Add(new Circle()); Shapes.Add(new Triangle()); Shapes.Add(new Line()); Shapes.Add(new Line()); Shapes.Add(new Line()); Shapes.Add(new Line()); }
public void Init(IShape left, IShape right) { Left = left; Right = right; left.Parent = this; right.Parent = this; Shapes.Add(Left); Shapes.Add(Right); }
protected override void Execute() { if (m_formerSpace != Target.Space) { m_formerSpace = Target.Space; Shapes.Clear(); Shapes.Add(new MyWorldShape(Target.Space)); } }
public void AddShape(Shape p) { if (p.Name == string.Empty) { p.Name = nextPathName; } Shapes.Add(p); p.Tag = IndexOf(p); // tag is position in collection UpdateExtent(p); }
public void AddRandomCustomShape() { Random rnd = new Random(); int x = rnd.Next(100, 1000); int y = rnd.Next(100, 600); CustomShape polygon = new CustomShape(new Rectangle(x, y, 100, 200)); Shapes.Add(polygon); }
public void AddChild(Shape s) { if (s == null) { throw new ArgumentNullException("Can't add null child"); } s.Parent = this; Shapes.Add(s); }
public void AddShape(GShape gShape) { Shapes.Add(gShape); //return if empty if (Shapes.Count == 0) { return; } CheckIntersection(gShape); }
public void Init() { Shapes.Add(new CPShape("Line")); Shapes.Add(new CPShape("ArrowLine")); Shapes.Add(new CPShape("BlockLine")); Shapes.Add(new CPShape("Square")); Shapes.Add(new CPShape("Circle")); TextBoxes.Add(new CPTextBox("Bubble")); }
/// <summary> /// Initializes this new instance of the Sketch class. /// </summary> internal void Initialize() { // Initialize Oval Style OvalStyle = new KimonoStyle() { StyleType = KimonoStyleType.Standard, HasFill = true, HasFrame = true }; // Configure new Oval Style OvalStyle.Fill.BlendMode = SKBlendMode.SrcOver; OvalStyle.Fill.IsAntialias = true; OvalStyle.FillColor = Orange; OvalStyle.Frame.BlendMode = SKBlendMode.SrcOver; OvalStyle.Frame.IsAntialias = true; OvalStyle.Frame.StrokeWidth = 1f; OvalStyle.Frame.StrokeMiter = 4f; OvalStyle.Frame.StrokeJoin = SKStrokeJoin.Mitter; OvalStyle.Frame.StrokeCap = SKStrokeCap.Butt; OvalStyle.Frame.Color = new SKColor(0, 0, 0, 255); // Property connections for Oval Style. OvalStyle.PropertyConnections.Add(new KimonoPropertyConnection(KimonoPropertyConnectionPoint.FillColor, ColorProperty)); // Initialize Sketch Name = "Sketch"; DrawCanvas = true; Width = 640f; Height = 480f; CanvasColor = new SKColor(255, 255, 255, 255); Portfolio = new KimonoPortfolio(true); Portfolio.Sketches.Add(this); ObiScriptPortfolio.Portfolio = Portfolio; // Draw Oval shape var Oval = new KimonoShapeOval(40.5625f, 47.37891f, 192.1406f, 194.7109f) { RotationDegrees = 0, Visible = true, Style = OvalStyle }; Shapes.Add(Oval); // Accumulate Kimono objects into the portfolio Portfolio.Colors.Add(Orange); Portfolio.Colors.Add(Purple); Portfolio.Styles.Add(OvalStyle); Portfolio.Properties.Add(UseOrange); Portfolio.Properties.Add(ColorProperty); }
protected override void DrawAxes() { foreach (var l in Shapes) { Canvas.Children.Remove(l); } var legend = Legend ?? new ChartLegend(); LoadLegend(legend); if (LegendLocation != LegendLocation.None) { Canvas.Children.Add(legend); Shapes.Add(legend); legend.UpdateLayout(); legend.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); } switch (LegendLocation) { case LegendLocation.None: break; case LegendLocation.Top: var top = new Point(ActualWidth * .5 - legend.DesiredSize.Width * .5, 0); PlotArea.Y += top.Y + legend.DesiredSize.Height; PlotArea.Height -= legend.DesiredSize.Height; Canvas.SetTop(legend, top.Y); Canvas.SetLeft(legend, top.X); break; case LegendLocation.Bottom: var bot = new Point(ActualWidth * .5 - legend.DesiredSize.Width * .5, ActualHeight - legend.DesiredSize.Height); PlotArea.Height -= legend.DesiredSize.Height; Canvas.SetTop(legend, Canvas.ActualHeight - legend.DesiredSize.Height); Canvas.SetLeft(legend, bot.X); break; case LegendLocation.Left: PlotArea.X += legend.DesiredSize.Width; PlotArea.Width -= legend.DesiredSize.Width; Canvas.SetTop(legend, Canvas.ActualHeight * .5 - legend.DesiredSize.Height * .5); Canvas.SetLeft(legend, 0); break; case LegendLocation.Right: PlotArea.Width -= legend.DesiredSize.Width; Canvas.SetTop(legend, Canvas.ActualHeight * .5 - legend.DesiredSize.Height * .5); Canvas.SetLeft(legend, ActualWidth - legend.DesiredSize.Width); break; default: throw new ArgumentOutOfRangeException(); } }
private void UpdateApplicationStateFromDiagram() { foreach (var umlShape in _diagram.Shapes) { Shapes.Add(new ShapeViewModel(umlShape)); } foreach (var umlLine in _diagram.Lines) { Lines.Add(new LineViewModel(umlLine)); } }
protected Excel.Shape AddShape(MsoAutoShapeType shapeType, Rect rect, Color color) { Excel.Shape shape = Chart.Shapes.AddShape(shapeType, (float)rect.Left, (float)rect.Top, (float)rect.Width, (float)rect.Height); shape.Fill.ForeColor.RGB = color.ToRgb(); shape.Fill.Transparency = color.GetAlpha(); Shapes.Add(shape); return(shape); }
public void CreateHexagon() { List <Point> points = getListPoints(); if (points.Count == 6) { PolygonShape polygonShape = new PolygonShape(genereteName("Hexagon"), points); Shapes.Add(polygonShape); RemoveAllPoint(); } }
/// <summary> /// Updates the collision shapes which are shown at the scene (at <see cref="SceneScreen"/>). /// </summary> protected void UpdateShapes() { // clear old shapes Shapes.Clear(); // update all shapes if (Actor.Shapes != null) { foreach (Shape shape in Actor.Shapes) { Shape newShape = shape.Clone(); newShape.Move(Position); newShape.Scale(ScaleFactor, Position); newShape.Rotate(Angle, Position); Shapes.Add(newShape); } } containsShapes = Shapes.Count != 0; // no shape if (Shapes.Count == 0) { // set rectangle to border texture if (sceneDrawable != null) { Polygon textureRectangle = sceneDrawable.GetBounds(Position); if (textureRectangle != null) { textureRectangle.Scale(ScaleFactor, Position); textureRectangle.Rotate(Angle, Position); Shapes.Add(textureRectangle); } } // set some shape otherwise the actor cannot be selected if (Shapes.Count == 0) { float defaultShapeSize = 50f; Polygon defaultRectangle = Polygon.CreateAsRectangle(Position - new Vector2(defaultShapeSize / 2f, defaultShapeSize / 2f), defaultShapeSize, defaultShapeSize); defaultRectangle.Scale(ScaleFactor, Position); defaultRectangle.Rotate(Angle, Position); Shapes.Add(defaultRectangle); } } // update AABB rectangle UpdateRectangle(); }
public void GetShapes(string fileName) { filePath = fileName; ObservableCollection <ShapeBase> observableCollection = shapesDAO.getShapes(fileName); Shapes.Clear(); foreach (var item in observableCollection) { Shapes.Add(item); } ChoosenShapeIndex = -1; }
public void CreatePentagon() { List <Point> points = getListPoints(); if (points.Count == 5) { MyPolygon polygonShape = new MyPolygon(genereteName("Pentagon"), points); Shapes.Add(polygonShape); RemoveAllPoint(); } }
/// <summary> /// Constructs a minkowski sum shape from cached data. /// </summary> /// <param name="shapeEntries">Entries composing the minkowski sum.</param> /// <param name="localOffset">Local offset of the elements in the minkowski sum.</param> /// <param name="description">Cached information about the shape. Assumed to be correct; no extra processing or validation is performed.</param> public MinkowskiSumShape(IList <OrientedConvexShapeEntry> shapeEntries, Vector3 localOffset, ConvexShapeDescription description) { for (int i = 0; i < shapeEntries.Count; i++) { Shapes.Add(shapeEntries[i]); } this.localOffset = localOffset; UpdateConvexShapeInfo(description); Shapes.Changed += ShapesChanged; }
private void AddStencilImplementation(Stencil stencil) { Suspend(); foreach (StencilItem item in stencil.Values) { Shape shape = new Shape(item); shape.Label = new TextLabel(item.Key); Shapes.Add(Shapes.CreateKey(), shape); } Resume(); }
private void DrawingAreaMouseUp(object sender, MouseEventArgs e) { if (!IsDrawing || e.Button != MouseButtons.Left) { return; } Shapes.Add(_currentlyDrawnShape); _currentlyDrawnShape = null; _undoneShapes.Clear(); UpdateUndoRedo(); Invalidate(); }
public BodyConstructor WithShape(Shape shape) { if (fixtureBuilderData.Count > 0 && Shapes.Count > 0) { throw new BodyConstructorException( "Ambiguous Body definition; multiple unnamed shapes and multiple " + "named fixtures supplied. Either have a single, unnamed default shape, " + "or supply each named fixture with a specific shape."); } Shapes.Add(shape); return(this); }
public void Add(ShapeComponent component) { Shapes.Add(component); if (Location.X > component.Location.X) { Location = new Point(component.Location.X, Location.Y); } if (Location.Y > component.Location.Y) { Location = new Point(Location.X, component.Location.Y); } SetNewGeometry(); }
public void CreatePolygon() { List <Point> points = getListPoints(); if (Math.Sqrt(Math.Pow(points[0].X - points[points.Count - 1].X, 2) + Math.Pow(points[0].Y - points[points.Count - 1].Y, 2)) <= 10 && points.Count > 2) { points.RemoveAt(points.Count - 1); PolygonShape polygonShape = new PolygonShape(genereteName("Polygon"), points); Shapes.Add(polygonShape); RemoveAllPoint(); } }
public void ReadShapes() { Shapes.Clear(); var eShapes = Slide.Shapes.GetEnumerator(); while (eShapes.MoveNext()) { Shape shape = (Shape)eShapes.Current; if (shape.HasTextFrame == Microsoft.Office.Core.MsoTriState.msoTrue) { Shapes.Add(shape); } } }