Example #1
0
        // private System.Collections.Generic.List<AtomicRegion> atoms = null;
        public override void MouseDown(object sender, MouseButtonEventArgs e)
        {
            System.Diagnostics.Debug.Assert(Atoms != null, "Atomic Regions not set for ShadedRegionCreator");

            CoordinateSystem cs        = Drawing.CoordinateSystem;
            Point            pt        = new Point(e.GetPosition(Drawing.Canvas).X, e.GetPosition(Drawing.Canvas).Y);
            Point            logicalPt = new Point(cs.ToLogical(pt.X - cs.Origin.X), cs.ToLogical(cs.Origin.Y - pt.Y));

            foreach (AtomicRegion ar in Atoms)
            {
                if (ar.PointLiesInside(new GeometryTutorLib.ConcreteAST.Point("shadingtest", logicalPt.X, logicalPt.Y)))
                {
                    ShadedRegion sr = new ShadedRegion(ar);
                    sr.Draw(Drawing, ShadedRegion.BRUSHES[0]);
                }
            }
        }
        // private System.Collections.Generic.List<AtomicRegion> atoms = null;
        public override void MouseDown(object sender, MouseButtonEventArgs e)
        {
            System.Diagnostics.Debug.Assert(Atoms != null, "Atomic Regions not set for ShadedRegionCreator");

            CoordinateSystem cs = Drawing.CoordinateSystem;
            Point pt = new Point(e.GetPosition(Drawing.Canvas).X, e.GetPosition(Drawing.Canvas).Y);
            Point logicalPt = new Point(cs.ToLogical(pt.X - cs.Origin.X), cs.ToLogical(cs.Origin.Y - pt.Y));

            foreach (AtomicRegion ar in Atoms)
            {
                if (ar.PointLiesInside(new GeometryTutorLib.ConcreteAST.Point("shadingtest", logicalPt.X, logicalPt.Y)))
                {
                    ShadedRegion sr = new ShadedRegion(ar);
                    sr.Draw(Drawing, ShadedRegion.BRUSHES[0]);
                }
            }
        }
Example #3
0
 /// <summary>
 /// If the problem is a shaded area problem, shade the goal regions.
 /// </summary>
 /// <param name="problem">The problem being drawn.</param>
 private void shadeProblem(UIProblemDrawer.ProblemDescription problem)
 {
     if (problem.Regions != null)
     {
         //Shade each region
         foreach (var region in problem.Regions)
         {
             ShadedRegion sr = new ShadedRegion(region);
             sr.Draw(drawingHost.CurrentDrawing, ShadedRegion.BRUSHES[1]);
         }
     }
 }
Example #4
0
 public void AddRegionShading(ShadedRegion sr)
 {
     RegionShadings.Add(sr);
     Canvas.Children.Add(sr.Shading);
 }