Esempio n. 1
0
 public void draw(Graphics g, CoordinateFrame frame)
 {
     Point a = frame.to_display((float)(owner.location.x), (float)(owner.location.y));
     Point b = frame.to_display((float)(owner.location.x + Math.Cos(angle + owner.heading) * distance),
                                (float)(owner.location.y + Math.Sin(angle + owner.heading) * distance));
     g.DrawLine(EngineUtilities.GreendPen, a, b);
 }
Esempio n. 2
0
        public void draw(Graphics g, CoordinateFrame frame)
        {
            Point a = frame.to_display((float)(owner.location.x + offsetx), (float)(owner.location.y + offsety));
            Point b = frame.to_display((float)(owner.location.x + offsetx + Math.Cos(angle + owner.heading) * distance),
                                       (float)(owner.location.y + offsety + Math.Sin(angle + owner.heading) * distance));

            g.DrawLine(EngineUtilities.GreendPen, a, b);
        }
Esempio n. 3
0
		public void draw(Graphics g, CoordinateFrame frame)
        {
			Point a = frame.to_display((float)(owner.location.x+offsetx),(float)(owner.location.y+offsety));
	        Point b = frame.to_display((float)(a.X+Math.Cos(startAngle+owner.heading)*distance),
			                           (float)(a.Y+Math.Sin(startAngle+owner.heading)*distance));
			Point c = frame.to_display((float)(a.X+Math.Cos(endAngle+owner.heading)*distance),
			                           (float)(a.Y+Math.Sin(endAngle+owner.heading)*distance));
			g.DrawLine(EngineUtilities.GreendPen, a, b);
			g.DrawLine(EngineUtilities.GreendPen, a, c);
			g.DrawLine(EngineUtilities.GreendPen, b, c);
		}
Esempio n. 4
0
        public void draw(Graphics g, CoordinateFrame frame)
        {
			float ax,ay,bx,by;
			frame.to_display((float)line.p1.x,(float)line.p1.y,out ax, out ay);
			frame.to_display((float)line.p2.x,(float)line.p2.y,out bx, out by);
			

                if (visible)
                    g.DrawLine(EngineUtilities.BluePen, ax,ay, bx,by);
                else
                    g.DrawLine(EngineUtilities.GreendPen, ax,ay,bx, by);
        }
Esempio n. 5
0
        //default robot draw method
        public virtual void draw(Graphics g, CoordinateFrame frame)
        {
            Point upperleft = frame.to_display((float)(circle.p.x - radius),(float)(circle.p.y- radius));
            int size = (int)((radius*2)/frame.scale);
            Rectangle r = new Rectangle(upperleft.X,upperleft.Y,size,size);
            if (disabled)
                g.DrawEllipse(EngineUtilities.YellowPen, r);
            else if (collide_last)
                g.DrawEllipse(EngineUtilities.RedPen, r);
            else if (corrected)
                g.DrawEllipse(EngineUtilities.YellowPen, r);
            else
                g.DrawEllipse(EngineUtilities.BluePen, r);
            int sensCount=0;
            foreach(ISensor sensor in sensors)
            {
                sensor.draw(g,frame);
            }

            if(display_debug)
            foreach(ISensor sensor in sensors)
            {
                if(draw_sensors) {
                double val = sensor.get_value();
                if(val<0.0) val=0.0;
                if(val>1.0) val=1.0;
                Color col = Color.FromArgb((int)(val*255),0,0); //(int)(val*255),(int)(val*255));
                SolidBrush newpen = new SolidBrush(col);
                g.FillRectangle(newpen,sensCount*40,500+30*id,40,30);
                sensCount+=1;
                }
            }
        }
Esempio n. 6
0
        public void draw(Graphics g, CoordinateFrame frame)
        {
            float ax, ay, bx, by;

            frame.to_display((float)line.p1.x, (float)line.p1.y, out ax, out ay);
            frame.to_display((float)line.p2.x, (float)line.p2.y, out bx, out by);


            if (visible)
            {
                g.DrawLine(EngineUtilities.BluePen, ax, ay, bx, by);
            }
            else
            {
                g.DrawLine(EngineUtilities.GreendPen, ax, ay, bx, by);
            }
        }
Esempio n. 7
0
		public void draw(Graphics g, CoordinateFrame frame)
        {
			Point a = frame.to_display((float)(owner.location.x),(float)(owner.location.y));
	        //Point b = frame.to_display((float)(a.X+Math.Cos(startAngle+owner.heading)*distance),
			 //                          (float)(a.Y+Math.Sin(startAngle+owner.heading)*distance));
			//Point c = frame.to_display((float)(a.X+Math.Cos(endAngle+owner.heading)*distance),
			 //                          (float)(a.Y+Math.Sin(endAngle+owner.heading)*distance));
			Pen pen = EngineUtilities.RedPen;
			if(val>0.5) pen=EngineUtilities.GreendPen;
			g.DrawRectangle(pen, a.X, a.Y,8,8);
		}
Esempio n. 8
0
 public void draw(Graphics g, CoordinateFrame frame)
 {
     Point upperleft = frame.to_display((float)(circle.p.x - circle.radius), (float)(circle.p.y - circle.radius));
     int size = (int)((circle.radius * 2) / frame.scale);
     Rectangle r = new Rectangle(upperleft.X, upperleft.Y, size, size);
     if (caught)
         g.DrawEllipse(EngineUtilities.BluePen, r);
     else if (visible)
         g.DrawEllipse(EngineUtilities.RedPen, r);
     else
         g.DrawEllipse(EngineUtilities.GreendPen, r);
 }
        public void draw(Graphics g, CoordinateFrame frame)
        {
            if (viewed > 0.0)
            {
                float ox, oy;
                frame.to_display((float)cx, (float)cy, out ox, out oy);

                g.FillEllipse(new System.Drawing.SolidBrush(Color.FromArgb(255, 255 - (int)(viewed * 255), 255 - (int)(viewed * 255))), ox, oy, 25, 25);
                //g.FillEllipse(System.Drawing.Brushes.IndianRed, ox, oy, 25, 25);
                //Console.WriteLine(cx+" " + cy + " " + ox + " " +oy);
            }
        }
Esempio n. 10
0
        //default robot draw method
        public virtual void draw(Graphics g, CoordinateFrame frame)
        {
            Point     upperleft = frame.to_display((float)(circle.p.x - radius), (float)(circle.p.y - radius));
            int       size      = (int)((radius * 2) / frame.scale);
            Rectangle r         = new Rectangle(upperleft.X, upperleft.Y, size, size);

            if (disabled)
            {
                g.DrawEllipse(EngineUtilities.YellowPen, r);
            }
            else if (collide_last)
            {
                g.DrawEllipse(EngineUtilities.RedPen, r);
            }
            else if (corrected)
            {
                g.DrawEllipse(EngineUtilities.YellowPen, r);
            }
            else
            {
                g.DrawEllipse(EngineUtilities.BluePen, r);
            }
            int sensCount = 0;

            foreach (ISensor sensor in sensors)
            {
                sensor.draw(g, frame);
            }

            if (display_debug)
            {
                foreach (ISensor sensor in sensors)
                {
                    if (draw_sensors)
                    {
                        double val = sensor.get_value();
                        if (val < 0.0)
                        {
                            val = 0.0;
                        }
                        if (val > 1.0)
                        {
                            val = 1.0;
                        }
                        Color      col    = Color.FromArgb((int)(val * 255), 0, 0); //(int)(val*255),(int)(val*255));
                        SolidBrush newpen = new SolidBrush(col);
                        g.FillRectangle(newpen, sensCount * 40, 500 + 30 * id, 40, 30);
                        sensCount += 1;
                    }
                }
            }
        }
Esempio n. 11
0
        public void draw(Graphics g, CoordinateFrame frame)
        {
            if (viewed > 0.0)
            {
                float ox, oy;
                frame.to_display((float)cx, (float)cy, out ox, out oy);

                g.FillEllipse(new System.Drawing.SolidBrush(Color.FromArgb(255,255-(int)(viewed*255),255-(int)(viewed*255))), ox, oy, 25, 25);
                //g.FillEllipse(System.Drawing.Brushes.IndianRed, ox, oy, 25, 25);
                //Console.WriteLine(cx+" " + cy + " " + ox + " " +oy);

            }
        }
Esempio n. 12
0
        public void draw(Graphics g, CoordinateFrame frame)
        {
            float sx, sy;
            float gx, gy;

            frame.to_display((float)start_point.x, (float)start_point.y, out sx, out sy);
            frame.to_display((float)goal_point.x, (float)goal_point.y, out gx, out gy);
            Rectangle startrect = new Rectangle((int)sx - 3, (int)sy - 3, 6, 6);
            Rectangle goalrect  = new Rectangle((int)gx - 3, (int)gy - 3, 6, 6);

            float rx, ry, rsx, rsy;

            frame.to_display((float)AOIRectangle.X, (float)AOIRectangle.Y, out rx, out ry);
            frame.offset_to_display((float)AOIRectangle.Width, (float)AOIRectangle.Height, out rsx, out rsy);
            Rectangle AOIDisplay = new Rectangle((int)rx, (int)ry, (int)rsx, (int)rsy);

            //Display Area of Interest rectangle
            g.DrawRectangle(EngineUtilities.DashedPen, AOIDisplay);

            g.DrawEllipse(EngineUtilities.BluePen, startrect);
            g.DrawEllipse(EngineUtilities.RedPen, goalrect);

            //Display Point Of Interests
            int index = 0;

            foreach (Point p in POIPosition)
            {
                Point p2 = frame.to_display(p);
                g.DrawEllipse(EngineUtilities.GreendPen, new Rectangle((int)p2.X - 3, (int)p2.Y - 3, 6, 6));
                g.DrawString(index.ToString(), new Font("Verdana", 8), new SolidBrush(Color.Black), p2.X, p2.Y);
                index++;
            }

            foreach (Wall wall in walls)
            {
                wall.draw(g, frame);
            }
        }
Esempio n. 13
0
        public void draw(Graphics g, CoordinateFrame frame)
        {
            Point a = frame.to_display((float)(owner.location.x), (float)(owner.location.y));
            //Point b = frame.to_display((float)(a.X+Math.Cos(startAngle+owner.heading)*distance),
            //                          (float)(a.Y+Math.Sin(startAngle+owner.heading)*distance));
            //Point c = frame.to_display((float)(a.X+Math.Cos(endAngle+owner.heading)*distance),
            //                          (float)(a.Y+Math.Sin(endAngle+owner.heading)*distance));
            Pen pen = EngineUtilities.RedPen;

            if (val > 0.5)
            {
                pen = EngineUtilities.GreendPen;
            }
            g.DrawRectangle(pen, a.X, a.Y, 8, 8);
        }
		public override void draw(Graphics g, CoordinateFrame frame)
        {
            Point upperleft = frame.to_display((float)(circle.p.x - radius),(float)(circle.p.y- radius));
			int size = (int)((radius*2)/frame.scale);
			Rectangle r = new Rectangle(upperleft.X,upperleft.Y,size,size);
            
            // Schrum: Colored rectangle for mode tracking 
            //Rectangle mode = new Rectangle(upperleft.X + (size / 4), upperleft.Y + (size / 4), size / 2, size / 2);
            // Schrum: Draw the mode rectangle
            //g.FillRectangle(EngineUtilities.modePen(currentBrainMode), mode);
            
            // Schrum: Alternative mode coloring method
            g.FillEllipse(EngineUtilities.modePen(currentBrainMode), r);

            if (disabled)
                g.DrawEllipse(EngineUtilities.YellowPen, r);
            else if (collide_last || confused)
                g.DrawEllipse(EngineUtilities.RedPen, r);
            else if (corrected)
                g.DrawEllipse(EngineUtilities.YellowPen, r);
            else if (autopilot)
                g.DrawEllipse(EngineUtilities.GreendPen, r);
            else
                g.DrawEllipse(EngineUtilities.BluePen, r);
			int sensCount=0;

			if(display_debug)
			foreach(float f in output_copy) {
				Color col = Color.FromArgb(0,0,(int)(f*255)); //(int)(val*255),(int)(val*255));
				SolidBrush newpen = new SolidBrush(col);
				g.FillRectangle(newpen,sensCount*40+400,500+30*id,40,30);
				sensCount+=1;
			}
			sensCount=0;
			
			foreach(ISensor sensor in sensors)
			{
				sensor.draw(g,frame);
				if(draw_sensors) {
				double val = sensor.get_value();
				if(val<0.0) val=0.0;
				if(val>1.0) val=1.0;
				if(display_debug) {
				Color col = Color.FromArgb((int)(val*255),0,0); //(int)(val*255),(int)(val*255));
				SolidBrush newpen = new SolidBrush(col);
				g.FillRectangle(newpen,sensCount*40,500+30*id,40,30);
				}
				sensCount+=1;
				}
			}
		}
        public override void draw(Graphics g, CoordinateFrame frame)
        {
            Point     upperleft = frame.to_display((float)(circle.p.x - radius), (float)(circle.p.y - radius));
            int       size      = (int)((radius * 2) / frame.scale);
            Rectangle r         = new Rectangle(upperleft.X, upperleft.Y, size, size);

            // Schrum: Colored rectangle for mode tracking
            //Rectangle mode = new Rectangle(upperleft.X + (size / 4), upperleft.Y + (size / 4), size / 2, size / 2);
            // Schrum: Draw the mode rectangle
            //g.FillRectangle(EngineUtilities.modePen(currentBrainMode), mode);

            // Schrum: Alternative mode coloring method
            g.FillEllipse(EngineUtilities.modePen(currentBrainMode), r);

            if (disabled)
            {
                g.DrawEllipse(EngineUtilities.YellowPen, r);
            }
            else if (collide_last || confused)
            {
                g.DrawEllipse(EngineUtilities.RedPen, r);
            }
            else if (corrected)
            {
                g.DrawEllipse(EngineUtilities.YellowPen, r);
            }
            else if (autopilot)
            {
                g.DrawEllipse(EngineUtilities.GreendPen, r);
            }
            else
            {
                g.DrawEllipse(EngineUtilities.BluePen, r);
            }
            int sensCount = 0;

            if (display_debug)
            {
                foreach (float f in output_copy)
                {
                    Color      col    = Color.FromArgb(0, 0, (int)(f * 255)); //(int)(val*255),(int)(val*255));
                    SolidBrush newpen = new SolidBrush(col);
                    g.FillRectangle(newpen, sensCount * 40 + 400, 500 + 30 * id, 40, 30);
                    sensCount += 1;
                }
            }
            sensCount = 0;

            foreach (ISensor sensor in sensors)
            {
                sensor.draw(g, frame);
                if (draw_sensors)
                {
                    double val = sensor.get_value();
                    if (val < 0.0)
                    {
                        val = 0.0;
                    }
                    if (val > 1.0)
                    {
                        val = 1.0;
                    }
                    if (display_debug)
                    {
                        Color      col    = Color.FromArgb((int)(val * 255), 0, 0); //(int)(val*255),(int)(val*255));
                        SolidBrush newpen = new SolidBrush(col);
                        g.FillRectangle(newpen, sensCount * 40, 500 + 30 * id, 40, 30);
                    }
                    sensCount += 1;
                }
            }
        }
Esempio n. 16
0
        public void draw(Graphics g, CoordinateFrame frame)
        {
            float sx,sy;
            float gx,gy;

            frame.to_display((float)start_point.x,(float)start_point.y,out sx, out sy);
            frame.to_display((float)goal_point.x,(float)goal_point.y,out gx,out gy);
            Rectangle startrect = new Rectangle((int)sx-3, (int)sy - 3, 6, 6);
            Rectangle goalrect = new Rectangle((int)gx-3, (int)gy -3, 6, 6);

            float rx,ry,rsx,rsy;
            frame.to_display((float)AOIRectangle.X,(float)AOIRectangle.Y,out rx,out ry);
            frame.offset_to_display((float)AOIRectangle.Width,(float)AOIRectangle.Height,out rsx, out rsy);
            Rectangle AOIDisplay = new Rectangle((int)rx,(int)ry,(int)rsx,(int)rsy);

            //Display Area of Interest rectangle
            g.DrawRectangle(EngineUtilities.DashedPen, AOIDisplay);

            g.DrawEllipse(EngineUtilities.BluePen, startrect);
            g.DrawEllipse(EngineUtilities.RedPen, goalrect);

            //Display Point Of Interests
            int index=0;
            foreach (Point p in POIPosition)
            {
                Point p2 = frame.to_display(p);
                g.DrawEllipse(EngineUtilities.GreendPen, new Rectangle((int)p2.X - 3, (int)p2.Y - 3, 6, 6));
                g.DrawString(index.ToString(), new Font("Verdana", 8), new SolidBrush(Color.Black), p2.X, p2.Y);
                index++;
            }

            foreach (Wall wall in walls)
            {
                wall.draw(g, frame);
            }

            foreach (Prey prey in preys)
            {
                prey.draw(g, frame);
            }
        }
Esempio n. 17
0
        public override void draw(Graphics g,CoordinateFrame frame)
        {
            Rectangle r = new Rectangle();
			float cx,cy;
			frame.to_display((float)circle.p.x,(float)circle.p.y,out cx,out cy);
			r.X = (int)(cx-radius/frame.scale);
			r.Y = (int)(cy-radius/frame.scale);
			r.Height = (int)((radius * 2) / frame.scale);
            r.Width = (int)((radius * 2) / frame.scale);
            if (collide_last)
                g.DrawEllipse(Pens.Red, r);
            else
                g.DrawEllipse(Pens.Blue, r);



            float x1 = (float)(Math.Cos(heading + 0.51f) * radius);
            float y1 = (float)(Math.Sin(heading + 0.51f) * radius);
            float x2 = (float)(Math.Cos(heading - 0.51f) * radius);
            float y2 = (float)(Math.Sin(heading - 0.51f) * radius);

            float x3 = (float)(Math.Cos(heading + 0.51f + 3.14f) * radius);
            float y3 = (float)(Math.Sin(heading + 0.51f + 3.14f) * radius);
            float x4 = (float)(Math.Cos(heading - 0.51f + 3.14f) * radius);
            float y4 = (float)(Math.Sin(heading - 0.51f + 3.14f) * radius);
			
			float ox1,ox2,ox3,ox4;
			float oy1,oy2,oy3,oy4;
			
			frame.offset_to_display(x1,y1,out ox1,out oy1);
			ox1+=cx;
			oy1+=cy;

			frame.offset_to_display(x2,y2,out ox2,out oy2);
			ox2+=cx;
			oy2+=cy;

			frame.offset_to_display(x3,y3,out ox3,out oy3);
			ox3+=cx;
			oy3+=cy;

			frame.offset_to_display(x4,y4,out ox4,out oy4);
			ox4+=cx;
			oy4+=cy;

			
            g.DrawLine(Pens.Blue, ox1, oy1, ox2, oy2);
            g.DrawLine(Pens.Blue, ox2, oy2, ox3, oy3);
            g.DrawLine(Pens.Blue, ox1, oy1, ox4, oy4);
            g.DrawLine(Pens.Blue, ox3, oy3, ox4, oy4);
            //3.14=1.57

            //if (scene.POIPosition.Count == sim_engine.robots.Count)
            //{
            //    g.DrawLine(redpen, new PointF((float)location.x, (float)location.y),
            //        new PointF(this.scene.POIPosition[agentIndex].X, this.scene.POIPosition[agentIndex].Y));
            //}

            float dx, dy;

            dx = (float)(radius * Math.Cos(heading));
            dy = (float)(radius * Math.Sin(heading));
			float odx,ody;
			frame.offset_to_display(dx,dy,out odx,out ody);
			dx+=cx;
			dy+=cy;
            g.DrawLine(Pens.Blue, cx,cy, dx,dy);

            //TODO: Lable drawing code, how do we know to do this?
            //label drawing
            //if (bDrawLabel)
            //    g.DrawString(robot_count.ToString(), new Font("Tahoma", 12, FontStyle.Bold), Brushes.Black, r.X, r.Y + (float)radius);
 			foreach(ISensor sensor in sensors)
			{
				sensor.draw(g,frame);
			}
			
        }
Esempio n. 18
0
        public override void draw(Graphics g, CoordinateFrame frame)
        {
            Rectangle r = new Rectangle();
            float     cx, cy;

            frame.to_display((float)circle.p.x, (float)circle.p.y, out cx, out cy);
            r.X      = (int)(cx - radius / frame.scale);
            r.Y      = (int)(cy - radius / frame.scale);
            r.Height = (int)((radius * 2) / frame.scale);
            r.Width  = (int)((radius * 2) / frame.scale);
            if (collide_last)
            {
                g.DrawEllipse(Pens.Red, r);
            }
            else
            {
                g.DrawEllipse(Pens.Blue, r);
            }



            float x1 = (float)(Math.Cos(heading + 0.51f) * radius);
            float y1 = (float)(Math.Sin(heading + 0.51f) * radius);
            float x2 = (float)(Math.Cos(heading - 0.51f) * radius);
            float y2 = (float)(Math.Sin(heading - 0.51f) * radius);

            float x3 = (float)(Math.Cos(heading + 0.51f + 3.14f) * radius);
            float y3 = (float)(Math.Sin(heading + 0.51f + 3.14f) * radius);
            float x4 = (float)(Math.Cos(heading - 0.51f + 3.14f) * radius);
            float y4 = (float)(Math.Sin(heading - 0.51f + 3.14f) * radius);

            float ox1, ox2, ox3, ox4;
            float oy1, oy2, oy3, oy4;

            frame.offset_to_display(x1, y1, out ox1, out oy1);
            ox1 += cx;
            oy1 += cy;

            frame.offset_to_display(x2, y2, out ox2, out oy2);
            ox2 += cx;
            oy2 += cy;

            frame.offset_to_display(x3, y3, out ox3, out oy3);
            ox3 += cx;
            oy3 += cy;

            frame.offset_to_display(x4, y4, out ox4, out oy4);
            ox4 += cx;
            oy4 += cy;


            g.DrawLine(Pens.Blue, ox1, oy1, ox2, oy2);
            g.DrawLine(Pens.Blue, ox2, oy2, ox3, oy3);
            g.DrawLine(Pens.Blue, ox1, oy1, ox4, oy4);
            g.DrawLine(Pens.Blue, ox3, oy3, ox4, oy4);
            //3.14=1.57

            //if (scene.POIPosition.Count == sim_engine.robots.Count)
            //{
            //    g.DrawLine(redpen, new PointF((float)location.x, (float)location.y),
            //        new PointF(this.scene.POIPosition[agentIndex].X, this.scene.POIPosition[agentIndex].Y));
            //}

            float dx, dy;

            dx = (float)(radius * Math.Cos(heading));
            dy = (float)(radius * Math.Sin(heading));
            float odx, ody;

            frame.offset_to_display(dx, dy, out odx, out ody);
            dx += cx;
            dy += cy;
            g.DrawLine(Pens.Blue, cx, cy, dx, dy);

            //TODO: Lable drawing code, how do we know to do this?
            //label drawing
            //if (bDrawLabel)
            //    g.DrawString(robot_count.ToString(), new Font("Tahoma", 12, FontStyle.Bold), Brushes.Black, r.X, r.Y + (float)radius);
            foreach (ISensor sensor in sensors)
            {
                sensor.draw(g, frame);
            }
        }