36 #include <QFileDialog> 50 MultiresImagePlugin::MultiresImagePlugin() :
54 config_widget_(new QWidget()),
62 p.setColor(QPalette::Background, Qt::white);
65 QPalette p2(
ui_.status->palette());
66 p2.setColor(QPalette::Text, Qt::red);
67 ui_.status->setPalette(p2);
69 QObject::connect(
ui_.browse, SIGNAL(clicked()),
this, SLOT(
SelectFile()));
71 QObject::connect(
ui_.x_offset_spin_box, SIGNAL(valueChanged(
double)),
this, SLOT(
SetXOffset(
double)));
72 QObject::connect(
ui_.y_offset_spin_box, SIGNAL(valueChanged(
double)),
this, SLOT(
SetYOffset(
double)));
85 if (message ==
ui_.status->text().toStdString())
89 QPalette p(
ui_.status->palette());
90 p.setColor(QPalette::Text, Qt::red);
91 ui_.status->setPalette(p);
92 ui_.status->setText(message.c_str());
97 if (message ==
ui_.status->text().toStdString())
101 QPalette p(
ui_.status->palette());
102 p.setColor(QPalette::Text, Qt::green);
103 ui_.status->setPalette(p);
104 ui_.status->setText(message.c_str());
109 if (message ==
ui_.status->text().toStdString())
113 QPalette p(
ui_.status->palette());
114 p.setColor(QPalette::Text, Qt::darkYellow);
115 ui_.status->setPalette(p);
116 ui_.status->setText(message.c_str());
121 ROS_INFO(
"Accept multires image configuration.");
143 QPalette p(
ui_.status->palette());
144 p.setColor(QPalette::Text, Qt::green);
145 ui_.status->setPalette(p);
146 ui_.status->setText(
"OK");
166 dialog.setFileMode(QFileDialog::ExistingFile);
167 dialog.setNameFilter(tr(
"Geo Files (*.geo)"));
171 if (dialog.result() == QDialog::Accepted && dialog.selectedFiles().count() == 1)
173 ui_.path->setText(dialog.selectedFiles().first());
253 for (
int r = 0; r < layer->
RowCount(); r++)
270 if (path.has_root_path())
272 if (path.root_path() != base.root_path())
283 if (base.has_root_path())
285 ROS_WARN(
"Cannot uncomplete a path relative path from a rooted base.");
290 typedef boost::filesystem::path::const_iterator path_iterator;
291 path_iterator path_it = path.begin();
292 path_iterator base_it = base.begin();
293 while (path_it != path.end() && base_it != base.end())
295 if (*path_it != *base_it)
300 boost::filesystem::path
result;
301 for (; base_it != base.end(); ++base_it)
305 for (; path_it != path.end(); ++path_it)
318 std::string path_string;
319 node[
"path"] >> path_string;
321 boost::filesystem::path image_path(path_string);
322 if (image_path.is_complete() ==
false)
324 boost::filesystem::path base_path(path);
326 (path / image_path.relative_path()).
normalize().string();
329 ui_.path->setText(path_string.c_str());
334 if (node[
"offset_x"])
337 ui_.x_offset_spin_box->setValue(offset_x_);
339 if (node[
"offset_y"])
342 ui_.y_offset_spin_box->setValue(offset_y_);
348 boost::filesystem::path abs_path(
ui_.path->text().toStdString());
349 boost::filesystem::path base_path(path);
352 emitter << YAML::Key <<
"path" << YAML::Value << rel_path.string();
353 emitter << YAML::Key <<
"offset_x" << YAML::Value <<
offset_x_;
354 emitter << YAML::Key <<
"offset_y" << YAML::Value <<
offset_y_;
void GetCenterPoint(double x, double y)
swri_transform_util::TransformManager tf_manager_
void SaveConfig(YAML::Emitter &emitter, const std::string &path)
QWidget * GetConfigWidget(QWidget *parent)
swri_transform_util::Transform inverse_transform_
swri_transform_util::GeoReference & GeoReference()
void PrintError(const std::string &message)
TFSIMD_FORCE_INLINE const tfScalar & getY() const
std::string target_frame_
void SetYOffset(double latitude_offset)
static tf::Quaternion createIdentityQuaternion()
void LoadConfig(const YAML::Node &node, const std::string &path)
std::string source_frame_
void PrintWarning(const std::string &message)
MultiresView * tile_view_
multires_image::TileSet * tile_set_
swri_transform_util::Transform transform_
boost::filesystem::path MakePathRelative(boost::filesystem::path path, boost::filesystem::path base)
void AcceptConfiguration()
TFSIMD_FORCE_INLINE Vector3 & normalize()
void SetView(double x, double y, double radius, double scale)
TFSIMD_FORCE_INLINE const tfScalar & getX() const
void PrintInfo(const std::string &message)
TileSetLayer * GetLayer(int layer)
Tile * GetTile(int column, int row)
virtual ~MultiresImagePlugin()
void Draw(double x, double y, double scale)
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
void Transform(const swri_transform_util::Transform &transform)
void SetXOffset(double long_offset)
bool Initialize(QGLWidget *canvas)