提交 d36d181b 编写于 作者: D dangyuedong 提交者: Jiangtao Hu

Framework: fix cyber_monitor potential issue; Modules: fix visualizer camera image format issue

上级 038f5dde
......@@ -180,7 +180,7 @@ bool LogFileObject::CreateLogfile(const std::string& time_pid_string) {
// entire log directory gets relocated the link is still valid.
const char* linkdest = slash ? (slash + 1) : filename;
// silently ignore failures
if (!symlink(linkdest, linkpath.c_str())) {
if (symlink(linkdest, linkpath.c_str())) {
AERROR << "symlink failed.";
}
}
......
......@@ -131,10 +131,10 @@ class ChannelMessage : public GeneralMessageBase {
const std::string& NodeName(void) const { return channel_node_->Name(); }
void add_reader(const std::string& reader) { readers_.push_back(reader); }
void add_reader(const std::string& reader) { DoAdd(readers_, reader); }
void del_reader(const std::string& reader) { DoDelete(readers_, reader); }
void add_writer(const std::string& writer) { writers_.push_back(writer); }
void add_writer(const std::string& writer) { DoAdd(writers_, writer); }
void del_writer(const std::string& writer) {
DoDelete(writers_, writer);
if (!writers_.size()) {
......@@ -152,6 +152,16 @@ class ChannelMessage : public GeneralMessageBase {
}
}
static void DoAdd(std::vector<std::string>& vec, const std::string& str) {
for (auto iter = vec.begin(); iter != vec.end(); ++iter) {
if (*iter == str) {
return;
}
}
vec.emplace_back(str);
}
void set_has_message_come(bool b) { has_message_come_ = b; }
bool is_enabled_;
......
......@@ -20,6 +20,7 @@
#include "./screen.h"
#include "cybertron/message/message_traits.h"
#include "cybertron/proto/topology_change.pb.h"
#include "cybertron/proto/role_attributes.pb.h"
#include <ncurses.h>
#include <iomanip>
......@@ -71,9 +72,33 @@ RenderableMessage* CybertronTopologyMessage::Child(int lineNo) const {
void CybertronTopologyMessage::TopologyChanged(
const apollo::cybertron::proto::ChangeMsg& changeMsg) {
const std::string& nodeName = changeMsg.role_attr().node_name();
const std::string& channelName = changeMsg.role_attr().channel_name();
const std::string& msgTypeName = changeMsg.role_attr().message_type();
if (::apollo::cybertron::proto::OperateType::OPT_JOIN ==
changeMsg.operate_type()) {
bool isWriter = true;
if (::apollo::cybertron::proto::RoleType::ROLE_READER ==
changeMsg.role_type())
isWriter = false;
AddReaderWriter(changeMsg.role_attr(), isWriter);
} else {
auto iter = all_channels_map_.find(changeMsg.role_attr().channel_name());
if (iter != all_channels_map_.cend() &&
!ChannelMessage::isErrorCode(iter->second)) {
const std::string& nodeName = changeMsg.role_attr().node_name();
if (::apollo::cybertron::proto::RoleType::ROLE_WRITER ==
changeMsg.role_type()) {
changeMsg.role_attr();
iter->second->del_writer(nodeName);
} else {
iter->second->del_reader(nodeName);
}
}
}
}
void CybertronTopologyMessage::AddReaderWriter(
const apollo::cybertron::proto::RoleAttributes& role, bool isWriter) {
const std::string& channelName = role.channel_name();
if (!specified_channel_.empty() && specified_channel_ != channelName) {
return;
......@@ -83,54 +108,39 @@ void CybertronTopologyMessage::TopologyChanged(
col1_width_ = channelName.length();
}
if (::apollo::cybertron::proto::OperateType::OPT_JOIN ==
changeMsg.operate_type()) {
if (ChannelMsgFactory::Instance()->isFromHere(nodeName)) {
return;
}
ChannelMessage* channelMsg = nullptr;
auto iter = all_channels_map_.find(channelName);
if (iter == all_channels_map_.cend()) {
channelMsg = ChannelMsgFactory::Instance()->CreateChannelMessage(
msgTypeName, channelName);
if (!ChannelMessage::isErrorCode(channelMsg)) {
channelMsg->set_parent(this);
channelMsg->set_message_type(msgTypeName);
channelMsg->add_reader(channelMsg->NodeName());
}
const std::string& nodeName = role.node_name();
if (ChannelMsgFactory::Instance()->isFromHere(nodeName)) {
return;
}
all_channels_map_[channelName] = channelMsg;
} else {
channelMsg = iter->second;
}
ChannelMessage* channelMsg = nullptr;
const std::string& msgTypeName = role.message_type();
auto iter = all_channels_map_.find(channelName);
if (iter == all_channels_map_.cend()) {
channelMsg = ChannelMsgFactory::Instance()->CreateChannelMessage(
msgTypeName, channelName);
if (!ChannelMessage::isErrorCode(channelMsg)) {
if (::apollo::cybertron::proto::RoleType::ROLE_WRITER ==
changeMsg.role_type()) {
if (msgTypeName != apollo::cybertron::message::MessageType<
apollo::cybertron::message::RawMessage>()) {
channelMsg->set_message_type(msgTypeName);
}
channelMsg->add_writer(nodeName);
} else {
channelMsg->add_reader(nodeName);
}
channelMsg->set_parent(this);
channelMsg->set_message_type(msgTypeName);
channelMsg->add_reader(channelMsg->NodeName());
}
all_channels_map_[channelName] = channelMsg;
} else {
auto iter = all_channels_map_.find(channelName);
channelMsg = iter->second;
}
if (iter != all_channels_map_.cend() &&
!ChannelMessage::isErrorCode(iter->second)) {
if (::apollo::cybertron::proto::RoleType::ROLE_WRITER ==
changeMsg.role_type()) {
iter->second->del_writer(nodeName);
} else {
iter->second->del_reader(nodeName);
if (!ChannelMessage::isErrorCode(channelMsg)) {
if (isWriter) {
if (msgTypeName != apollo::cybertron::message::MessageType<
apollo::cybertron::message::RawMessage>()) {
channelMsg->set_message_type(msgTypeName);
}
channelMsg->add_writer(nodeName);
} else {
channelMsg->add_reader(nodeName);
}
}
}
......
......@@ -25,6 +25,7 @@ namespace apollo {
namespace cybertron {
namespace proto {
class ChangeMsg;
class RoleAttributes;
} // proto
} // cybertron
} // apollo
......@@ -41,7 +42,7 @@ class CybertronTopologyMessage : public RenderableMessage {
RenderableMessage* Child(int index) const override;
void TopologyChanged(const apollo::cybertron::proto::ChangeMsg& change_msg);
void AddReaderWriter(const apollo::cybertron::proto::RoleAttributes& role, bool isWriter);
private:
CybertronTopologyMessage(const CybertronTopologyMessage&) = delete;
CybertronTopologyMessage& operator=(const CybertronTopologyMessage&) = delete;
......
......@@ -99,9 +99,22 @@ int main(int argc, char *argv[]) {
topologyMsg.TopologyChanged(change_msg);
};
apollo::cybertron::service_discovery::TopologyManager::Instance()
->channel_manager()
->AddChangeListener(topologyCallback);
auto channelManager =
apollo::cybertron::service_discovery::TopologyManager::Instance()
->channel_manager();
channelManager->AddChangeListener(topologyCallback);
std::vector<apollo::cybertron::proto::RoleAttributes> roleVec;
channelManager->GetWriters(&roleVec);
for (auto &role : roleVec) {
topologyMsg.AddReaderWriter(role, true);
}
roleVec.clear();
channelManager->GetReaders(&roleVec);
for (auto &role : roleVec) {
topologyMsg.AddReaderWriter(role, false);
}
Screen *s = Screen::Instance();
......
......@@ -18,7 +18,6 @@
#include "cybertron/cybertron.h"
#include <QThread>
#include <functional>
#include <memory>
#include <string>
......@@ -29,10 +28,9 @@ template <typename T>
using CyberChannelCallback = std::function<void(const std::shared_ptr<T>&)>;
template <typename T>
class CyberChannReader : public QThread {
class CyberChannReader {
public:
explicit CyberChannReader(QObject* parent = nullptr)
: QThread(parent), channel_callback_(nullptr), channel_node_(nullptr) {}
CyberChannReader(void) : channel_callback_(nullptr), channel_node_(nullptr) {}
~CyberChannReader() { CloseChannel(); }
......@@ -47,9 +45,10 @@ class CyberChannReader : public QThread {
}
bool InstallCallbackAndOpen(CyberChannelCallback<T> channelCallback,
const std::string& channelName, const std::string& nodeName) {
return InstallCallback(channelCallback) && OpenChannel(channelName, nodeName);
const std::string& channelName,
const std::string& nodeName) {
return InstallCallback(channelCallback) &&
OpenChannel(channelName, nodeName);
}
bool InstallCallback(CyberChannelCallback<T> channelCallback) {
......@@ -62,8 +61,9 @@ class CyberChannReader : public QThread {
}
}
bool OpenChannel(const std::string& channelName, const std::string& nodeName) {
if(channelName.empty() || nodeName.empty()){
bool OpenChannel(const std::string& channelName,
const std::string& nodeName) {
if (channelName.empty() || nodeName.empty()) {
std::cerr << "Channel Name or Node Name must be not empty" << std::endl;
return false;
}
......@@ -78,15 +78,9 @@ class CyberChannReader : public QThread {
const std::string& NodeName(void) const { return channel_node_->Name(); }
void start(Priority priority = InheritPriority) {
if (channel_reader_ != nullptr) QThread::start(priority);
}
protected:
void run() override { apollo::cybertron::WaitForShutdown(); }
private:
bool CreateChannel(const std::string& channelName, const std::string& nodeName) {
bool CreateChannel(const std::string& channelName,
const std::string& nodeName) {
if (channel_node_ == nullptr) {
channel_node_ = apollo::cybertron::CreateNode(nodeName);
if (channel_node_ == nullptr) {
......
......@@ -22,7 +22,7 @@ Grid::Grid(int cellCountBySide)
grid_color_(128, 128, 128) {}
bool Grid::FillVertexBuffer(GLfloat* pBuffer) {
float x = CellCount() / 2.0f;
float x = static_cast<float>(CellCount()) / 2.0f;
float z;
for (z = -x; z <= x; ++z) {
......
......@@ -27,9 +27,9 @@ class Grid : public RenderableObject {
GLenum GetPrimitiveType(void) const { return GL_LINES; }
void SetupExtraUniforms(void) {
QVector3D color;
color.setX(grid_color_.redF());
color.setY(grid_color_.greenF());
color.setZ(grid_color_.blueF());
color.setX(static_cast<float>(grid_color_.redF()));
color.setY(static_cast<float>(grid_color_.greenF()));
color.setZ(static_cast<float>(grid_color_.blueF()));
shader_program_->setUniformValue("color", color);
}
......
......@@ -44,9 +44,16 @@ int main(int argc, char* argv[]) {
w.TopologyChanged(change_msg);
};
apollo::cybertron::service_discovery::TopologyManager::Instance()
->channel_manager()
->AddChangeListener(topologyCallback);
auto channelManager = apollo::cybertron::service_discovery::TopologyManager::Instance()
->channel_manager();
channelManager->AddChangeListener(topologyCallback);
std::vector<apollo::cybertron::proto::RoleAttributes> role_attr_vec;
channelManager->GetWriters(&role_attr_vec);
for (auto& role_attr : role_attr_vec) {
w.FindNewWriter(role_attr);
}
w.show();
return a.exec();
......
......@@ -16,6 +16,9 @@
#pragma once
#include <map>
#include <string>
#include <QMainWindow>
#include <QMenu>
#include <QMutex>
......@@ -51,6 +54,7 @@ class MainWindow : public QMainWindow {
~MainWindow();
void TopologyChanged(const apollo::cybertron::proto::ChangeMsg& change_msg);
void FindNewWriter(const apollo::cybertron::proto::RoleAttributes& role);
protected:
void resizeEvent(QResizeEvent*) override;
......@@ -98,6 +102,9 @@ class MainWindow : public QMainWindow {
void ImageReaderCallback(
const std::shared_ptr<const apollo::drivers::Image>& imgData,
VideoImgProxy* proxy);
void ImageReaderCallback(
const std::shared_ptr<const apollo::drivers::CompressedImage>& imgData,
VideoImgProxy* proxy);
void InsertAllChannelNames(void);
VideoImgProxy* AddVideoImgViewer(void);
......@@ -106,9 +113,10 @@ class MainWindow : public QMainWindow {
void calculateWH(void);
RadarData* createRadarData(void);
void DoOpenRadarChannel(bool b, RadarData * radarProxy);
void RadarRenderCallback(const std::shared_ptr<const apollo::drivers::RadarObstacles>& rawData,
RadarData* radar);
void DoOpenRadarChannel(bool b, RadarData* radarProxy);
void RadarRenderCallback(
const std::shared_ptr<const apollo::drivers::RadarObstacles>& rawData,
RadarData* radar);
Ui::MainWindow* ui_;
MessageDialog* msg_dialog_;
......@@ -138,4 +146,7 @@ class MainWindow : public QMainWindow {
QList<RadarData*> radarData_list_;
QList<RadarData*> closed_radarData_list_;
std::map<std::string , std::string>
_channelName2TypeMap;
};
......@@ -62,39 +62,43 @@ bool Plane::FillVertexBuffer(GLfloat* pBuffer) {
void Plane::SetupAllAttrPointer(void) {
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE,
sizeof(GLfloat) * vertex_element_count(), 0);
glVertexAttribPointer(
0, 2, GL_FLOAT, GL_FALSE,
static_cast<int>(sizeof(GLfloat)) * vertex_element_count(), 0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE,
sizeof(GLfloat) * vertex_element_count(),
reinterpret_cast<void*>(sizeof(GLfloat) * 2));
glVertexAttribPointer(
1, 2, GL_FLOAT, GL_FALSE,
static_cast<int>(sizeof(GLfloat)) * vertex_element_count(),
reinterpret_cast<void*>(sizeof(GLfloat) * 2));
}
void Plane::Draw(void) {
if (texture_->isSizeChanged()) {
glGenTextures(1, &texture_id_);
glBindTexture(GL_TEXTURE_2D, texture_id_);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, texture_->width(),
texture_->height(), 0, texture_->texture_format(),
GL_UNSIGNED_BYTE, texture_->data());
glBindTexture(GL_TEXTURE_2D, 0);
texture_->removeDirty();
} else if (texture_->isDirty()) {
glBindTexture(GL_TEXTURE_2D, texture_id_);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, texture_->width(),
texture_->height(), texture_->texture_format(),
GL_UNSIGNED_BYTE, texture_->data());
glBindTexture(GL_TEXTURE_2D, 0);
texture_->removeDirty();
if (texture_->data()) {
if (texture_->isSizeChanged()) {
glGenTextures(1, &texture_id_);
glBindTexture(GL_TEXTURE_2D, texture_id_);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, texture_->width(),
texture_->height(), 0, texture_->texture_format(),
GL_UNSIGNED_BYTE, texture_->data());
glBindTexture(GL_TEXTURE_2D, 0);
texture_->removeDirty();
} else if (texture_->isDirty()) {
glBindTexture(GL_TEXTURE_2D, texture_id_);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, texture_->width(),
texture_->height(), texture_->texture_format(),
GL_UNSIGNED_BYTE, texture_->data());
glBindTexture(GL_TEXTURE_2D, 0);
texture_->removeDirty();
}
}
glActiveTexture(GL_TEXTURE0);
......
......@@ -58,7 +58,7 @@ bool PointCloud::FillData(
tmp[0] = point.x();
tmp[1] = point.z();
tmp[2] = -point.y();
tmp[3] = point.intensity();
tmp[3] = static_cast<float>(point.intensity());
}
return true;
}
......
......@@ -42,9 +42,9 @@ bool RadarPoints::FillData(
const apollo::common::Point2D& position =
iter->second.absolute_position();
ptr[0] = position.x();
ptr[1] = position.y();
ptr[2] = std::pow(10, iter->second.rcs() / 20.0);
ptr[0] = static_cast<float>(position.x());
ptr[1] = static_cast<float>(position.y());
ptr[2] = std::pow(10.0f, static_cast<float>(iter->second.rcs() / 20.0));
} // end for
ret = true;
......
......@@ -60,9 +60,9 @@ public:
}
void set_color(const QColor& color) {
color_.setX(color.redF());
color_.setY(color.greenF());
color_.setZ(color.blueF());
color_.setX(static_cast<float>(color.redF()));
color_.setY(static_cast<float>(color.greenF()));
color_.setZ(static_cast<float>(color.blueF()));
}
bool FillData(
......
......@@ -48,7 +48,7 @@ class RenderableObject : protected QOpenGLFunctions {
}
int VertexBufferSize(void) const {
return vertex_count() * vertex_element_count() * sizeof(GLfloat);
return vertex_count() * vertex_element_count() * static_cast<int>(sizeof(GLfloat));
}
void set_shader_program(
......@@ -74,7 +74,7 @@ class RenderableObject : protected QOpenGLFunctions {
virtual void SetupAllAttrPointer(void) {
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, vertex_element_count(), GL_FLOAT, GL_FALSE,
sizeof(GLfloat) * vertex_element_count(), 0);
static_cast<int>(sizeof(GLfloat)) * vertex_element_count(), 0);
}
bool is_init_;
......
......@@ -250,8 +250,8 @@ void SceneViewer::UpdateCameraYaw(double yawInDegrees) {
yawInDegrees += 360.0;
}
free_camera_.set_yaw(yawInDegrees);
target_camera_.set_yaw(yawInDegrees);
free_camera_.set_yaw(static_cast<float>(yawInDegrees));
target_camera_.set_yaw(static_cast<float>(yawInDegrees));
UpdateCameraWorld();
}
......@@ -263,8 +263,8 @@ void SceneViewer::UpdateCameraPitch(double pitchInDegrees) {
pitchInDegrees = -90.0;
}
free_camera_.set_pitch(pitchInDegrees);
target_camera_.set_pitch(pitchInDegrees);
free_camera_.set_pitch(static_cast<float>(pitchInDegrees));
target_camera_.set_pitch(static_cast<float>(pitchInDegrees));
UpdateCameraWorld();
}
void SceneViewer::UpdateCameraRoll(double rollInDegrees) {
......@@ -275,8 +275,8 @@ void SceneViewer::UpdateCameraRoll(double rollInDegrees) {
rollInDegrees += 360.0;
}
free_camera_.set_roll(rollInDegrees);
free_camera_.set_roll(rollInDegrees);
free_camera_.set_roll(static_cast<float>(rollInDegrees));
free_camera_.set_roll(static_cast<float>(rollInDegrees));
UpdateCameraWorld();
}
......@@ -316,7 +316,7 @@ void SceneViewer::mousePressEvent(QMouseEvent *event) {
left_key_last_pos_ = QCursor::pos();
} else if (event->button() == Qt::RightButton) {
right_key_is_moved_ = false;
right_key_last_y_ = QCursor::pos().y();
right_key_last_y_ = static_cast<float>(QCursor::pos().y());
}
QOpenGLWidget::mousePressEvent(event);
......@@ -328,8 +328,8 @@ void SceneViewer::mouseMoveEvent(QMouseEvent *mouseEvent) {
QPoint dd = tmp - left_key_last_pos_;
left_key_last_pos_ = tmp;
float x = dd.x() * sensitivity();
float y = dd.y() * sensitivity();
float x = static_cast<float>(dd.x()) * sensitivity();
float y = static_cast<float>(dd.y()) * sensitivity();
if (IsFreeCamera()) {
free_camera_.Starfe(-x);
......@@ -365,7 +365,7 @@ void SceneViewer::mouseMoveEvent(QMouseEvent *mouseEvent) {
right_key_is_moved_ = true;
if (IsFreeCamera()) {
{
float tmp = QCursor::pos().y();
float tmp = static_cast<float>(QCursor::pos().y());
float dd = right_key_last_y_ - tmp;
right_key_last_y_ = tmp;
......@@ -385,7 +385,7 @@ void SceneViewer::mouseMoveEvent(QMouseEvent *mouseEvent) {
}
void SceneViewer::wheelEvent(QWheelEvent *event) {
float delta = event->angleDelta().y();
float delta = static_cast<float>(event->angleDelta().y());
delta *= sensitivity();
target_camera_.set_distance(target_camera_.distance() + delta);
......
......@@ -26,7 +26,9 @@ Texture::Texture()
data_size_(0),
data_(nullptr) {}
bool Texture::UpdateData(const QImage &img) {
bool Texture::UpdateData(const QImage& img) {
std::cout << "Image: ImageSize = " << img.byteCount()
<< ", data_size_ = " << data_size_;
if (data_size_ < img.byteCount()) {
if (!data_) {
delete[] data_;
......@@ -41,17 +43,26 @@ bool Texture::UpdateData(const QImage &img) {
is_size_changed_ = true;
}
image_height_ = img.height();
image_width_ = img.width();
memcpy(data_, img.bits(), img.byteCount());
is_dirty_ = true;
image_height_ = img.height();
image_width_ = img.width();
std::cout << ", imgWidth = " << image_width_
<< ", imgHeight = " << image_height_
<< ", w * h * sizeof(GL_RGB) = "
<< image_width_ * image_height_ * sizeof(GL_RGB)
<< ",format = " << img.pixelFormat().colorModel() << std::endl;
texture_format_ = GL_RGBA;
return true;
}
bool Texture::UpdateData(const std::shared_ptr<const apollo::drivers::Image>& imgData){
std::size_t imgSize = imgData->data().size();
bool Texture::UpdateData(
const std::shared_ptr<const apollo::drivers::Image>& imgData) {
std::size_t imgSize = imgData->width() * imgData->height() * 3;
if (static_cast<std::size_t>(data_size_) < imgSize) {
if (!data_) {
delete[] data_;
......@@ -62,15 +73,54 @@ bool Texture::UpdateData(const std::shared_ptr<const apollo::drivers::Image>& im
data_size_ = 0;
return false;
}
data_size_ = imgSize;
data_size_ = static_cast<GLsizei>(imgSize);
is_size_changed_ = true;
}
memcpy(data_, imgData->data().c_str(), imgSize);
if(imgData->encoding() == std::string("yuyv")){
const GLubyte* src = reinterpret_cast<const GLubyte*>(imgData->data().c_str());
auto clamp = [](int v) -> GLubyte {
int ret = v;
if(v < 0) { ret = 0; }
if(v > 255) { ret = 255; }
return static_cast<GLubyte>(ret);
};
GLubyte* dst = data_;
for(std::size_t i = 0; i < imgData->data().size(); i += 4){
int y = 298 * (src[i] - 16);
int u = src[i + 1] - 128;
int u1 = 516 * u;
int v = src[i + 3] - 128;
int v1 = 208 * v;
u *= 100;
v *= 409;
*dst++ = clamp((y + v + 128) >> 8);
*dst++ = clamp((y - u - v1 + 128) >> 8);
*dst++ = clamp((y + u1 + 128) >> 8);
y = 298 * (src[i + 2] - 16);
*dst++ = clamp((y + v + 128) >> 8);
*dst++ = clamp((y - u - v1 + 128) >> 8);
*dst++ = clamp((y + u1 + 128) >> 8);
}
} else if (imgData->encoding() == std::string("rgb8")){
memcpy(data_, imgData->data().c_str(), imgSize);
} else {
memset(data_, 0, imgSize);
std::cerr << "Cannot support this format ("
<< imgData->encoding() << ") image" << std::endl;
}
is_dirty_ = true;
image_width_ = imgData->width();
image_height_ = imgData->height();
image_width_ = imgData->width();
texture_format_ = GL_RGB;
return true;
......
......@@ -169,8 +169,8 @@
<addaction name="actionOpenImage"/>
<addaction name="actionOpenImages"/>
<addaction name="actionDelImage"/>
<addaction name="separator"/>
<addaction name="actionRadar"/>
<!-- <addaction name="separator"/>
<addaction name="actionRadar"/> -->
</widget>
<widget class="QMenu" name="menuActions">
<property name="title">
......@@ -323,11 +323,11 @@
<string>F9</string>
</property>
</action>
<action name="actionRadar">
<!-- <action name="actionRadar">
<property name="text">
<string>Radar</string>
</property>
</action>
</action> -->
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
......@@ -479,7 +479,7 @@
</hint>
</hints>
</connection>
<connection>
<!-- <connection>
<sender>actionRadar</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
......@@ -494,7 +494,7 @@
<y>376</y>
</hint>
</hints>
</connection>
</connection> -->
</connections>
<slots>
<slot>ActionOpenImage()</slot>
......@@ -503,6 +503,6 @@
<slot>ActionAddGrid()</slot>
<slot>ActionOpenImages()</slot>
<slot>CloseVideoImgViewer(bool)</slot>
<slot>ActionOpenRadarChannel()</slot>
<!-- <slot>ActionOpenRadarChannel()</slot> -->
</slots>
</ui>
......@@ -82,7 +82,7 @@ void VideoImgViewer::initializeGL() {
ortho_camera_.set_near_plane_width(GLfloat(width()));
ortho_camera_.set_near_plane_height(GLfloat(height()));
ortho_camera_.set_fov(height());
ortho_camera_.set_fov(static_cast<float>(height()));
ortho_camera_.set_camera_mode(AbstractCamera::CameraMode::OrthoMode);
ortho_camera_.set_position(0.0f, 0.0f, 0.0f);
......@@ -103,7 +103,7 @@ void VideoImgViewer::resizeGL(int width, int height) {
glViewport(0, 0, (GLsizei)width, (GLsizei)height);
if (is_init_) {
ortho_camera_.set_fov(height);
ortho_camera_.set_fov(static_cast<float>(height));
ortho_camera_.set_near_plane_width(GLfloat(width));
ortho_camera_.set_near_plane_height(GLfloat(height));
ortho_camera_.UpdateProjection();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册