Changeset 1240 for trunk/sources/HeuristicLab.Visualization/WorldShape.cs
- Timestamp:
- 03/02/09 22:03:41 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization/WorldShape.cs
r1234 r1240 11 11 private RectangleD clippingArea; // own clipping area 12 12 private RectangleD boundingBox; 13 private IShape parent; 13 14 14 pr otectedreadonly List<IShape> shapes = new List<IShape>();15 private readonly List<IShape> shapes = new List<IShape>(); 15 16 16 public WorldShape() 17 : this(new RectangleD(0, 0, 1, 1), new RectangleD(0, 0, 1, 1)) {} 18 19 /// <param name="clippingArea">The new clipping area of this world shape</param> 20 /// <param name="boundingBox">The location and the size of this world shape in the parent's coordinate system</param> 21 public WorldShape(RectangleD clippingArea, RectangleD boundingBox) { 22 this.clippingArea = clippingArea; 23 this.boundingBox = boundingBox; 17 public WorldShape() { 18 this.clippingArea = new RectangleD(0, 0, 1, 1); 19 this.boundingBox = new RectangleD(0, 0, 1, 1); 24 20 } 25 21 26 public virtual void Draw(Graphics graphics , Rectangle parentViewport, RectangleD parentClippingArea) {22 public virtual void Draw(Graphics graphics) { 27 23 GraphicsState gstate = graphics.Save(); 28 24 29 // calculate our drawing area on the screen using our location and 30 // size in the parent (boundingBox), the parent's viewport and the 31 // parent's clipping area 32 Rectangle viewport = Transform.ToScreen(boundingBox, parentViewport, parentClippingArea); 33 34 graphics.SetClip(viewport); 25 graphics.SetClip(Viewport); 35 26 36 27 foreach (IShape shape in shapes) { 37 28 // draw child shapes using our own clipping area 38 shape.Draw(graphics , viewport, clippingArea);29 shape.Draw(graphics); 39 30 } 40 31 … … 56 47 } 57 48 49 public Rectangle Viewport { 50 get { 51 // calculate our drawing area on the screen using our location and 52 // size in the parent (boundingBox), the parent's viewport and the 53 // parent's clipping area 54 Rectangle viewport = Transform.ToScreen(boundingBox, Parent.Viewport, Parent.ClippingArea); 55 return viewport; 56 } 57 } 58 59 public IShape Parent { 60 get { return parent; } 61 set { parent = value; } 62 } 63 64 public void ClearShapes() { 65 shapes.Clear(); 66 } 67 58 68 public void AddShape(IShape shape) { 69 shape.Parent = this; 59 70 shapes.Add(shape); 60 71 }
Note: See TracChangeset
for help on using the changeset viewer.