Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00030
00031
00032
00033 #ifndef DRAWABLE_MARBLEWIDGET_H
00034 #define DRAWABLE_MARBLEWIDGET_H
00035
00036 #include "marble/MarbleWidget.h"
00037 #include "marble/GeoPainter.h"
00038 #include "marble/GeoDataLineString.h"
00039
00040 #include <QList>
00041 #include <QPolygonF>
00042 #include <QQueue>
00043
00044 #include <visualization_msgs/Marker.h>
00045 #include <visualization_msgs/MarkerArray.h>
00046 #include <sensor_msgs/NavSatFix.h>
00047 #include <std_msgs/ColorRGBA.h>
00048
00049 #include "visualisation_marker/circle.h"
00050 #include "visualisation_marker/colored_polygon.h"
00051
00052 using namespace Marble;
00053
00054 namespace rqt_marble_plugin {
00055
00056 class DrawableMarbleWidget : public MarbleWidget
00057 {
00058 Q_OBJECT
00059
00060 public:
00061 DrawableMarbleWidget(QWidget *parent=0);
00062
00063 void setCurrentPosition( GeoDataCoordinates& postion );
00064 void setMatchedPosition( GeoDataCoordinates& postion );
00065
00066 void visualizationMarkerArrayCallback(const visualization_msgs::MarkerArrayConstPtr &markers);
00067 void visualizationCallback(const visualization_msgs::MarkerConstPtr &marker);
00068
00069 void referenceGpsCallback(const sensor_msgs::NavSatFixConstPtr &reference);
00070
00071
00072
00073 protected:
00074 virtual void customPaint(GeoPainter *painter);
00075
00076 private:
00077 void addMarker(const visualization_msgs::Marker& marker);
00078 QImage roateCar(QImage* car_image);
00079
00080 void loadImage(QImage& car, std::string& path );
00081 bool posChanged(double x1, double y1, double x2, double y2, double threshold);
00082 std::pair<double, double> toGpsCoordinates(double x, double y);
00083 void getColor(QColor &outputColor, std_msgs::ColorRGBA color_msg);
00084
00085 std::string getMarkerId(visualization_msgs::Marker marker);
00086 void removeOldCircles(const ros::Time &actual_time);
00087 void removeOldPolygons(const ros::Time &actual_time);
00088 void addLineStrip(const visualization_msgs::Marker &marker);
00089 void addLineList(const visualization_msgs::Marker &marker);
00090 void addSphereList(const visualization_msgs::Marker &marker);
00091 void addSphere(const visualization_msgs::Marker &marker);
00092
00094 std::pair<double, double> GetAbsoluteCoordinates( double x , double y , double ref_lat , double ref_lon, double ref_bearing = 0. );
00095 std::pair<double, double> GetNewPointBearingDistance(double a_lat, double a_lon, double bearing, double distance);
00096
00097 QImage m_arrow;
00098 QImage m_current_pos_icon;
00099 QImage m_matched;
00100
00101
00102 std::map<std::string, PolygonSet> m_marker_line;
00103 std::map<std::string, CircleSet> m_marker_circle;
00104
00105 GeoDataCoordinates m_current_pos;
00106 GeoDataCoordinates m_matched_pos;
00107 GeoDataCoordinates m_last_matched_position;
00108
00109
00110 double m_ref_lat;
00111 double m_ref_lon;
00112
00113
00114 Q_DISABLE_COPY(DrawableMarbleWidget);
00115 };
00116
00117 }
00118
00119 #endif //DRAWABLE_MARBLEWIDGET_H