/home/martin/workspace/OpenStreetNav/src/osmdb/ToShowEdgesSelector.h
Go to the documentation of this file.
00001 /*
00002  * ToShowEdgesSelector.h
00003  *
00004  *  Created on: Dec 29, 2011
00005  *      Author: martin
00006  */
00007 
00008 #ifndef TOSHOWEDGESSELECTOR_H_
00009 #define TOSHOWEDGESSELECTOR_H_
00010 
00011 #include <memory>
00012 #include "../displayer/LineDisplayStyle.h"
00013 #include "../displayer/DisplayLine.h"
00014 
00015 namespace osmdb
00016 {
00017 
00018 class ToShowEdgesSelector
00019 {
00020 public:
00027     template<typename... Args>
00028     static std::vector<std::unique_ptr<display::DisplayElement> > get_edges(psql::Statement < psql::BindTypes<Args...>,
00029             psql::RetTypes<double, double, double, double, double, double, double, double, double, int, int> > & st,
00030             Args... args)
00031     {
00032         std::vector<std::unique_ptr<display::DisplayElement> > ret;
00033         st.execute(args...);
00034         for (int i = 0; i < st.row_count(); ++i)
00035         {
00036             double lon1, lat1, lon2, lat2, r, g, b, a, t;
00037             int attrs, p;
00038             bool arrow = attrs & 1;
00039             std::tie(lon1, lat1, lon2, lat2, r, g, b, a, t, attrs, p) = st.get_row(i);
00040             ret.push_back(std::unique_ptr<display::DisplayElement>(
00041                               new display::DisplayLine(
00042                                   geo::Point(lat1, lon1),
00043                                   geo::Point(lat2, lon2),
00044                                   arrow,
00045                                   std::unique_ptr<display::DisplayStyle>(
00046                                       new display::LineDisplayStyle(r, g, b, a, t)
00047                                   ))));
00048         }
00049         return ret;
00050     }
00051 };
00052 
00053 } /* namespace osmdb */
00054 #endif /* TOSHOWEDGESSELECTOR_H_ */
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines