Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# Tools/Debugging/DebugDrawings.h

Go to the documentation of this file.

    00001 /**
    00002 * @file Tools/Debugging/DebugDrawings.h
    00003 *
    00004 * Macros for drawing
    00005 *
    00006 * @author <a href="mailto:juengel@informatik.hu-berlin.de">Matthias Jüngel</a>
    00007 */
    00008
    00009 #ifndef __DebugDrawings_h_
    00010 #define __DebugDrawings_h_
    00011
    00012 #include "Tools/Debugging/Debugging.h"
    00013 #include "Tools/Debugging/DebugKeyTable.h"
    00014 //#include "Platform/GTAssert.h"
    00015
    00016
    00017 #include "DebugDrawings2.h"
    00018
    00019 /**
    00020 * This class includes all enumeration types and methods that are necessary
    00021 * to transmit messages for debug drawings
    00022 */
    00023 class Drawings
    00024 {
    00025 public:
    00026
    00027   /** IDs for shape types
    00028   * shapes are the basic drawings that can be sent´.
    00029   */
    00030   enum ShapeType
    00031   {
    00032     circle, filledCircle, line, dot, largeDot, octangle, arrow, coloredLine, midDot
    00033   };
    00034
    00035   /**
    00036   * IDs for debug drawings on the field.
    00037   * enter new debug drawings here and add the corresponding string in getDrawingName.
    00038   */
    00039   enum FieldDrawing
    00040   {
    00041     // the field
    00042     fieldPolygons, /*!< the polygons of the 2D field view */
    00043     fieldLines, /*!< the lines of the 2D field view  */
    00044
    00045     // percepts
    00046     percepts_ballFlagsGoalsField, /*!< player, ball and landmarks percepts on the field view. */
    00047     percepts_obstaclesAndPSDField, /*!< obstacles and psd percepts on the field view. */
    00048     percepts_specialField, /*!< special percept on field */
    00049     percepts_robot,
    00050     lineCrossingsField, /*!< crossings of lines displayed on the field*/
    00051     multipleBallPerceptsField,
    00052     circlePoints_Field,
    00053
    00054     // models
    00055     worldStateOracle, /*!< the oracled world state (displayed ligter) */
    00056     worldStateGTCam, /*!< the oracled world state (displayed ligter) */
    00057     worldState, /*!< the world state as calculated by the modules */
    00058     worldStateRemoteCam, /*!< the remote camera world state (displayed lighter) */
    00059     models_obstaclesField, /*!< the obstacles model */
    00060
    00061     // modules
    00062     selfLocatorField,/*!< visualization of the particles in the monte carlo selflocalization */
    00063     ballLocatorField,/*!< visualization of hypothesis regarding the ball */
    00064     goaliePositionField,/*!< visualization of the goalie position */
    00065     headControlField,/*!< visualization what feature of the environment HeadControl is aiming at */
    00066     teamBallLocatorFieldParticles,
    00067     teamBallLocatorField,
    00068     comboBallLocatorField,
    00069     comboTeamBallLocatorField,
    00070     playerModelField, /*!< visualization of the player model. Opponent and own players */
    00071
    00072     //      obstaclesLocatorField, /*! Drawings for the SensorFusionPlayersLocator */
    00073     behavior_CBBVector, /*! Drawings for ContinuosBasicBehavior1 */
    00074     behavior_CBBWay, /*! Drawings for ContinuosBasicBehavior2 */
    00075     behavior_kickAngles, /*! Drawings for several kick angles */
    00076     behavior_aStarSearch, /*! Drawings for A* search tree */
    00077
    00078     dribbleBall, /*! Drawings for dribble ball */
    00079
    00080     logAnalyzer, /*! Drawings from the logfile analyzer */
    00081     logAnalyzerDots, /*! Dot Drawings from the logfile analyzer */
    00082
    00083     // radar viewer
    00084     firstDrawingInRadarViewer, /*!< all drawings below here are shown in the radar view */
    00085     percepts_ballFlagsGoalsRadar = firstDrawingInRadarViewer, /*!< player, ball and landmarks percepts on the radar view. */
    00086     percepts_obstaclesAndPSDRadar, /*!< obstacles and psd percepts on the radar view. */
    00087     models_obstaclesRadar, /*!< obstacles model in radar view */
    00088     models_corridorsRadar, /*! All corridors that are calculated */
    00089     behavior_kickAnglesRadar,  /*!< kick angles in radar view */
    00090
    00091     numberOfFieldDrawings
    00092   };
    00093
    00094   /**
    00095   * IDs for debug drawings on the field.
    00096   * enter new debug drawings here and add the corresponding string in getDrawingName.
    00097   */
    00098   enum ImageDrawing
    00099   {
    00100     percepts_ball,
    00101     percepts_flagsGoals,
    00102     percepts_freePartOfGoal,
    00103     percepts_lines,
    00104     percepts_edges,
    00105     percepts_obstacles,
    00106     percepts_psd,
    00107     percepts_special,
    00108     models_obstacles,
    00109     models_freePartOfGoal,
    00110     selfLocator,
    00111     imageProcessor_general,
    00112     imageProcessor_horizon,
    00113     imageProcessor_scanLines,
    00114     imageProcessor_coloredSegments1,
    00115     imageProcessor_coloredSegments2,
    00116     imageProcessor_coloredSegments3,
    00117     imageProcessor_calibration1,
    00118     imageProcessor_calibration2,
    00119     imageProcessor_ball1,
    00120     imageProcessor_ball2,
    00121     imageProcessor_ball3,
    00122     imageProcessor_ball4,
    00123     imageProcessor_ground,
    00124     imageProcessor_flagsAndGoals,
    00125     imageProcessor_obstacles,
    00126     imageProcessor_gradients,
    00127     imageProcessor_edges,
    00128     imageProcessor_lines,
    00129     imageProcessor_linefragments,
    00130     imageProcessor_robot_detection,
    00131     sketch,
    00132     imageProcessor_multipleBallPercepts,
    00133     circlePoints_image,
    00134     numberOfImageDrawings
    00135   };
    00136
    00137   enum TypeOfDrawing
    00138   {
    00139     drawingOnField,
    00140     drawingOnImage
    00141   };
    00142
    00143   static TypeOfDrawing getTypeOfDrawing(FieldDrawing) {return drawingOnField;}
    00144   static TypeOfDrawing getTypeOfDrawing(ImageDrawing) {return drawingOnImage;}
    00145
    00146   /**
    00147   * Returns a description for an indexed fieldDrawing.
    00148   * \attention Add descriptions for new fieldDrawings here.
    00149   */
    00150   static const char* getDrawingName(FieldDrawing fieldDrawing)
    00151   {
    00152     switch (fieldDrawing)
    00153     {
    00154     case fieldPolygons: return "field polygons";
    00155     case fieldLines: return "field lines";
    00156
    00157     case percepts_ballFlagsGoalsField: return "percepts: ball; flags; goals";
    00158     case percepts_obstaclesAndPSDField: return "percepts: obstacles; PSD";
    00159     case percepts_specialField: return "percepts: special";
    00160     case percepts_robot:return "percepts: robot";
    00161
    00162     case worldStateOracle: return "world state oracle";
    00163     case worldState: return "world state";
    00164     case worldStateRemoteCam: return "remote camera world state";
    00165     case worldStateGTCam: return "GTCam world state";
    00166     case models_obstaclesField: return "models: obstacles";
    00167
    00168     case selfLocatorField: return "self locator";
    00169     case ballLocatorField: return "ball locator";
    00170     case goaliePositionField: return "goalie position";
    00171     case headControlField: return "head control";
    00172     case teamBallLocatorFieldParticles: return "team ball locator particles";
    00173     case teamBallLocatorField: return "team ball locator";
    00174     case comboBallLocatorField: return "combo ball locator";
    00175     case comboTeamBallLocatorField: return "combo team ball locator";
    00176     case playerModelField: return "player model";
    00177       //    case obstaclesLocatorField: return "obstacles locator";
    00178     case behavior_CBBVector: return "behavior: CBBVector";
    00179     case behavior_CBBWay: return "behavior: CBBWay";
    00180     case behavior_kickAngles: return "behavior: kick angles";
    00181     case behavior_aStarSearch: return "behavior: A* search tree";
    00182     case dribbleBall: return "dribble Ball";
    00183     case logAnalyzer: return "logfile analyzer lines";
    00184     case logAnalyzerDots: return "logfile analyzer dots";
    00185
    00186     case percepts_ballFlagsGoalsRadar: return "radar - percepts: ball; flags; goals";
    00187     case percepts_obstaclesAndPSDRadar: return "radar - percepts: obstacles; PSD";
    00188     case models_obstaclesRadar: return "radar - models: obstacles";
    00189     case models_corridorsRadar: return "radar - models: corridors";
    00190     case behavior_kickAnglesRadar: return "radar - behavior: kick angles";
    00191
    00192     case lineCrossingsField: return "line crossings";
    00193     case multipleBallPerceptsField: return "multiple ball percepts";
    00194     case circlePoints_Field: return "circlePoints_Field";
    00195
    00196     default: return "check available drawings";
    00197     }
    00198   }
    00199
    00200   /**
    00201   * Returns a description for an indexed imageDrawing.
    00202   * \attention Add descriptions for new image drawings here.
    00203   */
    00204   static const char* getDrawingName(ImageDrawing imageDrawing)
    00205   {
    00206     switch (imageDrawing)
    00207     {
    00208     case percepts_ball: return "percepts: ball";
    00209     case percepts_flagsGoals: return "percepts: flags; goals";
    00210     case percepts_freePartOfGoal: return "percepts: free part of goal";
    00211     case percepts_lines: return "percepts: lines";
    00212     case percepts_edges: return "percepts: edges";
    00213     case percepts_obstacles: return "percepts: obstacles";
    00214     case percepts_psd: return "percepts: psd";
    00215     case percepts_special: return "percepts: special";
    00216     case models_obstacles: return "models: obstacles";
    00217     case models_freePartOfGoal: return "models: free part of goal";
    00218     case selfLocator: return "self locator";
    00219     case imageProcessor_general: return "image processor: general";
    00220     case imageProcessor_horizon: return "image processor: horizon";
    00221     case imageProcessor_scanLines: return "image processor: scan lines";
    00222     case imageProcessor_coloredSegments1: return "image processor: colored segments1";
    00223     case imageProcessor_coloredSegments2: return "image processor: colored segments2";
    00224     case imageProcessor_coloredSegments3: return "image processor: colored segments3";
    00225     case imageProcessor_calibration1: return "image processor: calibration 1";
    00226     case imageProcessor_calibration2: return "image processor: calibration 2";
    00227     case imageProcessor_ball1: return "image processor: ball 1";
    00228     case imageProcessor_ball2: return "image processor: ball 2";
    00229     case imageProcessor_ball3: return "image processor: ball 3";
    00230     case imageProcessor_ball4: return "image processor: ball 4";
    00231     case imageProcessor_ground: return "image processor: ground";
    00232     case imageProcessor_flagsAndGoals: return "image processor: flags; goals";
    00233     case imageProcessor_obstacles: return "image processor: obstacles";
    00234     case imageProcessor_gradients: return "image processor: gradients";
    00235     case imageProcessor_edges: return "image processor: edges";
    00236     case imageProcessor_lines: return "image processor: lines";
    00237     case imageProcessor_linefragments: return "image processor: linefragments";
    00238     case imageProcessor_robot_detection: return "image processor: robot detection";
    00239     case sketch: return "sketch";
    00240     case imageProcessor_multipleBallPercepts: return "imageProcessor: multiple ball percepts";
    00241     case circlePoints_image: return "circlePoints_image";
    00242     default: return "check available drawings";
    00243     }
    00244   }
    00245
    00246   static bool getDebugKeyID(enum FieldDrawing fieldDrawing, DebugKeyTable::debugKeyID& debugKeyID)
    00247   {
    00248     switch (fieldDrawing)
    00249     {
    00250     case selfLocatorField: debugKeyID = DebugKeyTable::send_selfLocatorField_drawing; return true;
    00251     case ballLocatorField: debugKeyID = DebugKeyTable::send_ballLocatorField_drawing; return true;
    00252     case goaliePositionField: debugKeyID = DebugKeyTable::send_goaliePositionField_drawing; return true;
    00253     case headControlField: debugKeyID = DebugKeyTable::send_headControlField_drawing; return true;
    00254     case playerModelField: debugKeyID = DebugKeyTable::send_playerModelField_drawing; return true;
    00255     case teamBallLocatorFieldParticles: debugKeyID = DebugKeyTable::send_teamBallLocatorFieldParticles_drawing; return true;
    00256     case teamBallLocatorField: debugKeyID = DebugKeyTable::send_teamBallLocatorField_drawing; return true;
    00257     case comboBallLocatorField: debugKeyID = DebugKeyTable::send_comboBallLocatorField_drawing; return true;
    00258     case comboTeamBallLocatorField: debugKeyID = DebugKeyTable::send_comboTeamBallLocatorField_drawing; return true;
    00259       //    case obstaclesLocatorField: debugKeyID = DebugKeyTable::send_obstaclesLocatorField_drawing; return true;
    00260     case behavior_CBBVector: debugKeyID = DebugKeyTable::send_behavior_CBBVector_drawing; return true;
    00261     case behavior_CBBWay: debugKeyID = DebugKeyTable::send_behavior_CBBWay_drawing; return true;
    00262     case behavior_kickAngles: debugKeyID = DebugKeyTable::send_behavior_kickAngles_drawing; return true;
    00263     case behavior_aStarSearch: debugKeyID = DebugKeyTable::send_behavior_aStarSearch_drawing; return true;
    00264     case dribbleBall: debugKeyID = DebugKeyTable::send_dribbleBall_drawing; return true;
    00265
    00266     case models_corridorsRadar: debugKeyID = DebugKeyTable::send_models_corridorsRadar_drawing; return true;
    00267     case behavior_kickAnglesRadar: debugKeyID = DebugKeyTable::send_behavior_kickAnglesRadar_drawing; return true;
    00268     case percepts_robot: debugKeyID = DebugKeyTable::send_percepts_robot_drawing; return true;
    00269
    00270     case lineCrossingsField: debugKeyID = DebugKeyTable::send_lineCrossingsField_drawing; return true;
    00271     case multipleBallPerceptsField: debugKeyID = DebugKeyTable::send_multipleBallPerceptsField_drawing; return true;
    00272     case circlePoints_Field: debugKeyID = DebugKeyTable::send_circlePoints_Field_drawing; return true;
    00273     default: return false;
    00274     }
    00275   }
    00276
    00277   static bool getDebugKeyID(enum ImageDrawing imageDrawing, DebugKeyTable::debugKeyID& debugKeyID)
    00278   {
    00279     switch (imageDrawing)
    00280     {
    00281     case selfLocator: debugKeyID = DebugKeyTable::send_selfLocator_drawing; return true;
    00282     case imageProcessor_general: debugKeyID = DebugKeyTable::send_imageProcessor_general_drawing; return true;
    00283     case imageProcessor_horizon: debugKeyID = DebugKeyTable::send_imageProcessor_horizon_drawing; return true;
    00284     case imageProcessor_scanLines: debugKeyID = DebugKeyTable::send_imageProcessor_scanLines_drawing; return true;
    00285     case imageProcessor_coloredSegments1: debugKeyID = DebugKeyTable::send_imageProcessor_coloredSegments1_drawing; return true;
    00286     case imageProcessor_coloredSegments2: debugKeyID = DebugKeyTable::send_imageProcessor_coloredSegments2_drawing; return true;
    00287     case imageProcessor_coloredSegments3: debugKeyID = DebugKeyTable::send_imageProcessor_coloredSegments3_drawing; return true;
    00288     case imageProcessor_calibration1: debugKeyID = DebugKeyTable::send_imageProcessor_calibration1_drawing; return true;
    00289     case imageProcessor_calibration2: debugKeyID = DebugKeyTable::send_imageProcessor_calibration2_drawing; return true;
    00290     case imageProcessor_ball1: debugKeyID = DebugKeyTable::send_imageProcessor_ball1_drawing; return true;
    00291     case imageProcessor_ball2: debugKeyID = DebugKeyTable::send_imageProcessor_ball2_drawing; return true;
    00292     case imageProcessor_ball3: debugKeyID = DebugKeyTable::send_imageProcessor_ball3_drawing; return true;
    00293     case imageProcessor_ball4: debugKeyID = DebugKeyTable::send_imageProcessor_ball4_drawing; return true;
    00294     case imageProcessor_ground: debugKeyID = DebugKeyTable::send_imageProcessor_ground_drawing; return true;
    00295     case imageProcessor_flagsAndGoals: debugKeyID = DebugKeyTable::send_imageProcessor_flagsAndGoals_drawing; return true;
    00296     case imageProcessor_obstacles: debugKeyID = DebugKeyTable::send_imageProcessor_obstacles_drawing; return true;
    00297     case imageProcessor_gradients: debugKeyID = DebugKeyTable::send_imageProcessor_gradients_drawing; return true;
    00298     case imageProcessor_edges: debugKeyID = DebugKeyTable::send_imageProcessor_edges_drawing; return true;
    00299     case imageProcessor_lines: debugKeyID = DebugKeyTable::send_imageProcessor_lines_drawing; return true;
    00300     case imageProcessor_linefragments: debugKeyID = DebugKeyTable::send_imageProcessor_linefragments_drawing; return true;
    00301     case imageProcessor_robot_detection: debugKeyID = DebugKeyTable::send_imageProcessor_robot_detection_drawing; return true;
    00302     case sketch: debugKeyID = DebugKeyTable::send_sketch_drawing; return true;
    00303     case imageProcessor_multipleBallPercepts: debugKeyID = DebugKeyTable::send_imageProcessor_multipleBallPercepts_drawing; return true;
    00304     case circlePoints_image: debugKeyID = DebugKeyTable::send_circlePoints_image_drawing; return true;
    00305     default: return false;
    00306     }
    00307   }
    00308
    00309   /** The pen style that is used for basic shapes*/
    00310   enum PenStyle
    00311   {
    00312     ps_solid, ps_dash, ps_dot, ps_null
    00313   };
    00314
    00315   /** The fill style that is used for basic shapes*/
    00316   enum FillStyle
    00317   {
    00318     bs_solid, bs_null
    00319   };
    00320
    00321   /** The color that is used for basic shapes*/
    00322   enum Color
    00323   {
    00324     red, green, blue, yellow, orange, pink, skyblue, white, light_gray, gray, dark_gray, black, yellowOrange, numberOfColors
    00325   };
    00326
    00327 };
    00328
    00329 #ifdef NDEBUG
    00330 #define NODEBUGDRAWINGS
    00331 #endif
    00332 #ifdef NO_DEBUG_DRAWING
    00333 #define NODEBUGDRAWINGS
    00334 #endif
    00335
    00336 #ifdef NODEBUGDRAWINGS
    00337 #define CIRCLE(id, center_x, center_y, radius, penWidth, penStyle, penColor) /**/
    00338 #define DOT(id, x, y, penColor, fillColor) /**/
    00339 #define MID_DOT(id, x, y, penColor, fillColor) /**/
    00340 #define LARGE_DOT(id, x, y, penColor, fillColor) /**/
    00341 #define ARROW(id, x1, y1, x2, y2, penWidth, penStyle, penColor) /**/
    00342 #define LINE(id, x1, y1, x2, y2, penWidth, penStyle, penColor) /**/
    00343 #define COLORED_LINE(id, x1, y1, x2, y2, penWidth, penStyle, penColorR, penColorG, penColorB) /**/
    00344 #define POSE_2D_SAMPLE(id, p, color) /**/
    00345 #define OCTANGLE(id, x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6,x7,y7,x8,y8, color, fill) /**/
    00346 #define QUADRANGLE(id, x1,y1,x2,y2,x3,y3,x4,y4, penWidth, penStyle, penColor) /**/
    00347 #define RECTANGLE(id, x1,y1,x2,y2, penWidth, penStyle, penColor) /**/
    00348 #define CROSS(id, x, y, size, penWidth, penStyle, penColor) /**/
    00349
    00350 #define COMPLEX_DRAWING(id,expression) /**/
    00351 #define DEBUG_DRAWING_FINISHED(id) /**/
    00352
    00353 #else //NODEBUGDRAWINGS
    00354
    00355 /**
    00356 * A macro that sends a circle
    00357 * @param id A drawing id (Drawings::FieldDrawing or Drawings::ImageDrawing)
    00358 * @param center_x The x coordinate of the center of the circle
    00359 * @param center_y The y coordinate of the center of the circle
    00360 * @param radius The radius of the circle
    00361 * @param penWidth The width of the arc of the circle
    00362 * @param penStyle The pen style of the arc of the circle (Drawings::PenStyle)
    00363 * @param penColor The color of the arc of the circle (Drawings::Color)
    00364 */
    00365 #define CIRCLE(id, center_x, center_y, radius, penWidth, penStyle, penColor) \
    00366   INFO(send_##id##_drawing, idDebugDrawing2, bin, \
    00367   (char)Drawings::circle << \
    00368   (char)Drawings::id << \
    00369   (char)Drawings::getTypeOfDrawing(Drawings::id) << \
    00370   (int)(center_x) << (int)(center_y) << (int)(radius) << (char)(penWidth) << \
    00371   (char)(penStyle) << (char)(penColor) \
    00372   );
    00373
    00374 /**
    00375 * A macro that sends a dot (a quadratic box with a border)
    00376 * @param id A drawing id (Drawings::FieldDrawing or Drawings::ImageDrawing)
    00377 * @param x The x coordinate of the center of the box
    00378 * @param y The y coordinate of the center of the box
    00379 * @param penColor The color of the border of the dot (Drawings::Color)
    00380 * @param fillColor The color of the dot (Drawings::Color)
    00381 */
    00382 #define DOT(id, x, y, penColor, fillColor) \
    00383   INFO(send_##id##_drawing, idDebugDrawing2, bin, \
    00384   (char)Drawings::dot << \
    00385   (char)Drawings::id << \
    00386   (char)Drawings::getTypeOfDrawing(Drawings::id) << \
    00387   (int)(x) << (int)(y) << (char)(penColor) << (char)(fillColor) \
    00388   );
    00389
    00390
    00391 /**
    00392 * A macro that sends a midsize dot
    00393 * @param id A drawing id (Drawings::FieldDrawing or Drawings::ImageDrawing)
    00394 * @param x The x coordinate of the center of the box
    00395 * @param y The y coordinate of the center of the box
    00396 * @param penColor The color of the border of the dot (Drawings::Color)
    00397 * @param fillColor The color of the dot (Drawings::Color)
    00398 */
    00399 #define MID_DOT(id, x, y, penColor, fillColor) \
    00400   INFO(send_##id##_drawing, idDebugDrawing2, bin, \
    00401   (char)Drawings::midDot << \
    00402   (char)Drawings::id << \
    00403   (char)Drawings::getTypeOfDrawing(Drawings::id) << \
    00404   (int)(x) << (int)(y) << (char)(penColor) << (char)(fillColor) \
    00405   );
    00406
    00407 /**
    00408 * A macro that sends a dot (a quadratic box with a border)
    00409 * @param id A drawing id (Drawings::FieldDrawing or Drawings::ImageDrawing)
    00410 * @param x The x coordinate of the center of the box
    00411 * @param y The y coordinate of the center of the box
    00412 * @param penColor The color of the border of the dot (Drawings::Color)
    00413 * @param fillColor The color of the dot (Drawings::Color)
    00414 */
    00415 #define LARGE_DOT(id, x, y, penColor, fillColor) \
    00416   INFO(send_##id##_drawing, idDebugDrawing2, bin, \
    00417   (char)Drawings::largeDot << \
    00418   (char)Drawings::id << \
    00419   (char)Drawings::getTypeOfDrawing(Drawings::id) << \
    00420   (int)(x) << (int)(y) << (char)(penColor) << (char)(fillColor) \
    00421   );
    00422
    00423 /**
    00424 * A macro that sends a line
    00425 * @param id A drawing id (Drawings::FieldDrawing or Drawings::ImageDrawing)
    00426 * @param x1 The x coordinate of the starting point.
    00427 * @param y1 The y coordinate of the starting point.
    00428 * @param x2 The x coordinate of the end point.
    00429 * @param y2 The y coordinate of the end point.
    00430 * @param penWidth The width of the line
    00431 * @param penStyle The pen style of the line (Drawings::PenStyle)
    00432 * @param penColor The color of the line (Drawings::Color)
    00433 */
    00434 #define LINE(id, x1, y1, x2, y2, penWidth, penStyle, penColor) \
    00435   INFO(send_##id##_drawing, idDebugDrawing2, bin, \
    00436   (char)Drawings::line << \
    00437   (char)Drawings::id << \
    00438   (char)Drawings::getTypeOfDrawing(Drawings::id) << \
    00439   (int)(x1) << (int)(y1) << (int)(x2) << (int)(y2) << (char)(penWidth) << (char)(penStyle) << (char)(penColor) \
    00440   );
    00441
    00442 #define COLORED_LINE(id, x1, y1, x2, y2, penWidth, penStyle, penColorR, penColorG, penColorB) \
    00443   INFO(send_##id##_drawing, idDebugDrawing2, bin, \
    00444   (char)Drawings::coloredLine << \
    00445   (char)Drawings::id << \
    00446   (char)Drawings::getTypeOfDrawing(Drawings::id) << \
    00447   (int)(x1) << (int)(y1) << (int)(x2) << (int)(y2) << (char)(penWidth) << (char)(penStyle) << (char)(penColorR) << (char)(penColorG) << (char)(penColorB)\
    00448   );
    00449
    00450 #define CROSS(id, x, y, size, penWidth, penStyle, penColor)\
    00451   LINE(id, x+size, y+size, x-size,y-size, penWidth, penStyle, penColor);\
    00452   LINE(id, x+size, y-size, x-size,y+size, penWidth, penStyle, penColor);
    00453
    00454
    00455
    00456
    00457 /**
    00458 * A macro that sends an arrow
    00459 * @param id A drawing id (Drawings::FieldDrawing or Drawings::ImageDrawing)
    00460 * @param x1 The x coordinate of the starting point.
    00461 * @param y1 The y coordinate of the starting point.
    00462 * @param x2 The x coordinate of the end point.
    00463 * @param y2 The y coordinate of the end point.
    00464 * @param penWidth The width of the line
    00465 * @param penStyle The pen style of the line (Drawings::PenStyle)
    00466 * @param penColor The color of the line (Drawings::Color)
    00467 */
    00468 #define ARROW(id, x1, y1, x2, y2, penWidth, penStyle, penColor) \
    00469   INFO(send_##id##_drawing, idDebugDrawing2, bin, \
    00470   (char)Drawings::arrow << \
    00471   (char)Drawings::id << \
    00472   (char)Drawings::getTypeOfDrawing(Drawings::id) << \
    00473   (int)(x1) << (int)(y1) << (int)(x2) << (int)(y2) << (char)(penWidth) << (char)(penStyle) << (char)(penColor) \
    00474   );
    00475
    00476
    00477 /**
    00478 * A macro that sends an arrow for a pose
    00479 * @param id A drawing id (Drawings::FieldDrawing or Drawings::ImageDrawing)
    00480 * @param p A Pose2D describing the arrow
    00481 * @param color The color of the line arrow (Drawings::Color)
    00482 */
    00483 #define POSE_2D_SAMPLE(id, p, color) \
    00484   Pose2D current = p; current += Pose2D(-100,0); \
    00485   LINE(id, int(current.translation.x),int(current.translation.y), int(p.translation.x), int(p.translation.y), \
    00486   1, Drawings::ps_solid, color); \
    00487   current = p; current += Pose2D(-40,-40); \
    00488   LINE(id, int(current.translation.x), int(current.translation.y), int(p.translation.x), int(p.translation.y), \
    00489   1, Drawings::ps_solid, color); \
    00490   current = p; current += Pose2D(-40,40); \
    00491   LINE(id, int(current.translation.x),int(current.translation.y),int(p.translation.x), int(p.translation.y), \
    00492   1, Drawings::ps_solid, color); \
    00493
    00494 /**
    00495 * A macro that sends an octangle
    00496 * @param id A drawing id (Drawings::FieldDrawing or Drawings::ImageDrawing)
    00497 * @param x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6,x7,y7,x8,y8 The coordinates of the 8 octagon vertices
    00498 * @param color The color of the octangle
    00499 * @param fill A boolean indicating if the octangle is filled
    00500 */
    00501 #define OCTANGLE(id, x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6,x7,y7,x8,y8, color, fill) \
    00502   INFO(send_##id##_drawing, idDebugDrawing2, bin, \
    00503   (char)Drawings::octangle << \
    00504   (char)Drawings::id << \
    00505   (char)Drawings::getTypeOfDrawing(Drawings::id) << \
    00506   (int)(x1) << (int)(y1) << (int)(x2) << (int)(y2) << (int)(x3) << (int)(y3) << (int)(x4) << (int)(y4) << \
    00507   (int)(x5) << (int)(y5) << (int)(x6) << (int)(y6) << (int)(x7) << (int)(y7) << (int)(x8) << (int)(y8) << \
    00508   (char)ColorClasses::colorClassToDrawingsColor(color) << (char)fill \
    00509   );
    00510
    00511 /**
    00512 * A macro that sends an quadrangle
    00513 * @param x1,y1,x2,y2,x3,y3,x4,y4 The coordinates of the 4 quadrangle vertices
    00514 * @param id A drawing id (Drawings::FieldDrawing or Drawings::ImageDrawing)
    00515 * @param penWidth The line width of the quadrangle
    00516 * @param penStyle The line style, e.g. dotted
    00517 * @param penColor The color of the quadrangle
    00518 */
    00519 #define QUADRANGLE(id, x1,y1,x2,y2,x3,y3,x4,y4, penWidth, penStyle, penColor) \
    00520   LINE(id, x1, y1, x2, y2, penWidth, penStyle, penColor); \
    00521   LINE(id, x2, y2, x3, y3, penWidth, penStyle, penColor); \
    00522   LINE(id, x3, y3, x4, y4, penWidth, penStyle, penColor); \
    00523   LINE(id, x4, y4, x1, y1, penWidth, penStyle, penColor);
    00524
    00525 /**
    00526 * A macro that sends an rectangle
    00527 * @param x1,y1,x2,y2 The coordinates of 2 opposite corners
    00528 * @param id A drawing id (Drawings::FieldDrawing or Drawings::ImageDrawing)
    00529 * @param penWidth The line width of the rectangle
    00530 * @param penStyle The line style, e.g. dotted
    00531 * @param penColor The color of the quadrangle
    00532 */
    00533 #define RECTANGLE(id, x1,y1,x2,y2, penWidth, penStyle, penColor) \
    00534   LINE(id, x1, y1, x1, y2, penWidth, penStyle, penColor); \
    00535   LINE(id, x1, y2, x2, y2, penWidth, penStyle, penColor); \
    00536   LINE(id, x2, y2, x2, y1, penWidth, penStyle, penColor); \
    00537   LINE(id, x2, y1, x1, y1, penWidth, penStyle, penColor);
    00538
    00539 /**
    00540 * Complex drawings should be encapsuled by this macro.
    00541 */
    00542 #define COMPLEX_DRAWING(id,expression) \
    00543   if (getDebugKeyTable().isActive(DebugKeyTable::send_##id##_drawing)) {\
    00544   expression;\
    00545   }
    00546
    00547 /**
    00548 * Indicates that all elements of the specified drawing are drawn.
    00549 * @param id A drawing id (Drawings::FieldDrawing or Drawings::ImageDrawing)
    00550 */
    00551 #define DEBUG_DRAWING_FINISHED(id) \
    00552   INFO(send_##id##_drawing, idDebugDrawingFinished, bin, (char)Drawings::id << (char)Drawings::getTypeOfDrawing(Drawings::id) );
    00553
    00554 #endif //NODEBUGDRAWINGS
    00555 #endif //__DebugDrawings_h_
    00556