first commit
This commit is contained in:
224
project/fm_viewer/ui/rm_frame_graph.cpp
Normal file
224
project/fm_viewer/ui/rm_frame_graph.cpp
Normal file
@@ -0,0 +1,224 @@
|
||||
#include "rm_frame_graph.h"
|
||||
//#include "rm_speed_label.h"
|
||||
#include "rm_graph_widget.h"
|
||||
#include "fm_button.h"
|
||||
#include "fm_layer.h"
|
||||
#include "../fm_dimensions.h"
|
||||
#include "fm_frame_speed.h"
|
||||
#include "../core/fm_strings.h"
|
||||
#include "fm_colors.h"
|
||||
|
||||
|
||||
RMFrameGraph::RMFrameGraph(QWidget *parent) : RMWidgetBase(parent,true)
|
||||
{
|
||||
layout = new QHBoxLayout(this);
|
||||
ZERO_LAYOUT(layout);
|
||||
|
||||
layout->setAlignment(Qt::AlignLeft);
|
||||
|
||||
speed = new FMSpeedFrame(this);
|
||||
speed->setFixedSize(88,79);
|
||||
layout->addWidget(speed);
|
||||
|
||||
LAYOUT_SPACE(layout,1,0);
|
||||
createXYZLabel();
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
graph = new RMGraphWidget(this,QList<int>() << 1 << 2 << 4 << 8);
|
||||
#else
|
||||
graph = new RMGraphWidget(this,QList<int>() << 1 << 2 << 4);
|
||||
#endif
|
||||
graph->setFixedHeight(70);
|
||||
graph->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
layout->addWidget(graph);
|
||||
LAYOUT_SPACE(layout,2,0);
|
||||
createZoomButtons();
|
||||
}
|
||||
|
||||
void RMFrameGraph::createXYZLabel()
|
||||
{
|
||||
QWidget* w = new QWidget(this);
|
||||
w->setFixedWidth(66);
|
||||
layout->addWidget(w);
|
||||
//LAYOUT_DEBUG(w);
|
||||
QVBoxLayout* l = new QVBoxLayout(w);
|
||||
l->setAlignment(Qt::AlignTop);
|
||||
l->setContentsMargins(0,1,0,0); // 상단 마진
|
||||
l->setSpacing(0); // 버튼 간격
|
||||
|
||||
xOnBtn = RMFrameGraph::_createXYZ(w,l,"sensor_x",&xLabel,FM_SENSOR_COLOR_X);
|
||||
yOnBtn = RMFrameGraph::_createXYZ(w,l,"sensor_y",&yLabel,FM_SENSOR_COLOR_Y);
|
||||
zOnBtn = RMFrameGraph::_createXYZ(w,l,"sensor_z",&zLabel,FM_SENSOR_COLOR_Z);
|
||||
}
|
||||
FMButton* RMFrameGraph::_createXYZ(QWidget* parent, QLayout* layout, const char* icon, QLabel** lb, int color)
|
||||
{
|
||||
QSize bSize = QSize(30,25);
|
||||
|
||||
QWidget* w = new QWidget(parent);
|
||||
layout->addWidget(w);
|
||||
QHBoxLayout* lw = new QHBoxLayout(w);
|
||||
lw->setAlignment(Qt::AlignVCenter);
|
||||
ZERO_LAYOUT(lw);
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
FMButton* btn = FMButton::btnStatic2(w,lw,icon,NULL,bSize);
|
||||
#else // LIVE_LANGUAGE2
|
||||
FMButton* btn = FMButton::btnStatic(w,lw,icon,QString(""),bSize);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
QLabel* label = new QLabel(w);
|
||||
label->setText("-0.00");
|
||||
label->setFixedWidth(36-4);
|
||||
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
FMLabel(label,icon,"Arial",color, 12);
|
||||
|
||||
lw->addWidget(label);
|
||||
*lb = label;
|
||||
return btn;
|
||||
}
|
||||
|
||||
void RMFrameGraph::createZoomButtons()
|
||||
{
|
||||
QWidget* w = new QWidget(this);
|
||||
w->setFixedWidth(28);
|
||||
layout->addWidget(w);
|
||||
QVBoxLayout* l = new QVBoxLayout(w);
|
||||
l->setAlignment(Qt::AlignTop);
|
||||
l->setContentsMargins(0,2,0,0); // 상단 마진
|
||||
l->setSpacing(1); // 버튼 간격
|
||||
|
||||
QSize sz = QSize(28,36);
|
||||
// 확대-> 실제로는 스케일을 줄인다 拡大
|
||||
|
||||
#if (LIVE_LANGUAGE2)
|
||||
_zoomIn = FMButton::btn2(w,l,"graph_up","graph_zoom_in",sz);
|
||||
#else // LIVE_LANGUAGE2
|
||||
_zoomIn = FMButton::btn(w,l,"graph_up",FMS::txt("graph_zoom_in"),sz);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
QLabel* seperator = new QLabel(w);
|
||||
seperator->setPixmap(QPixmap(":/image/graph_seperator.png"));
|
||||
l->addWidget(seperator);
|
||||
#endif
|
||||
//LAYOUT_SPACE(l,0,1);
|
||||
|
||||
// 축소-> 실제로는 스케일을 늘린다 縮小
|
||||
#if (LIVE_LANGUAGE2)
|
||||
_zoomOut = FMButton::btn2(w,l,"graph_down","graph_zoom_out",sz);
|
||||
#else // LIVE_LANGUAGE2
|
||||
_zoomOut = FMButton::btn(w,l,"graph_down",FMS::txt("graph_zoom_out"),sz);
|
||||
#endif // LIVE_LANGUAGE2
|
||||
|
||||
#if (RM_MODEL_EMT_KR)
|
||||
_zoomOut->setEnabled(true);
|
||||
#else
|
||||
_zoomOut->setEnabled(false);
|
||||
#endif
|
||||
|
||||
LAYOUT_SPACE(layout,2,0); // 우측 마진
|
||||
|
||||
#if !(LIVE_LANGUAGE2)
|
||||
#if (LIVE_LANGUAGE_CHANGE)
|
||||
RMLanguage::instance()->appendENGToolTip(_zoomIn,"Zoom In");
|
||||
RMLanguage::instance()->appendENGToolTip(_zoomOut,"Zoom Out");
|
||||
#endif
|
||||
#endif // #if (LIVE_LANGUAGE2)
|
||||
|
||||
connect(_zoomIn,SIGNAL(clicked()),graph,SLOT(onZoomIn()));
|
||||
connect(_zoomOut,SIGNAL(clicked()),graph,SLOT(onZoomOut()));
|
||||
connect(graph,SIGNAL(zoomChange(bool,bool)),SLOT(onZoomChange(bool,bool)));
|
||||
|
||||
graph->setLabels(xLabel,yLabel,zLabel);
|
||||
}
|
||||
|
||||
#if (MODEL_STANDARD)
|
||||
void RMFrameGraph::onZoomChange(bool zi,bool zo)
|
||||
{
|
||||
_zoomOut->setEnabled(zo);
|
||||
_zoomIn->setEnabled(zi);
|
||||
}
|
||||
#endif
|
||||
|
||||
void RMFrameGraph::onAppEvent(RMApp::Event event,int param)
|
||||
{
|
||||
Q_UNUSED(param)
|
||||
if(event == RMApp::WillFullScreen || event == RMApp::WillNormalScreen)
|
||||
{
|
||||
#if (USE_MAXIMIZE)
|
||||
// MAXIMAIZE 모드에서는 처리하지 않음
|
||||
if(event == RMApp::WillFullScreen && param == 0) {
|
||||
setHidden(true);
|
||||
}
|
||||
else {
|
||||
setHidden(false);
|
||||
}
|
||||
#else
|
||||
setHidden(event == RMApp::WillFullScreen);
|
||||
#endif
|
||||
}
|
||||
#if (USE_MAXIMIZE)
|
||||
if (event == RMApp::DidFullScreen || event == RMApp::DidNormalScreen)
|
||||
{
|
||||
graph->redraw();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
//void RMFrameGraph::onPlayEvent(PLAY_EVENT event,RMVideoItem* item)
|
||||
//{
|
||||
/*
|
||||
if(event == PLAY_DID_LOADED)
|
||||
{
|
||||
_cursorX = -1;
|
||||
if(item != NULL) {
|
||||
currentData = item->getSensorData();
|
||||
}
|
||||
_updatePolygon();
|
||||
_itemDurationMSec = (double)item->durationInMSecs();
|
||||
}
|
||||
else if(event == PLAY_DID_CLEARED)
|
||||
{
|
||||
_cursorX = -1;
|
||||
currentData= NULL;
|
||||
_polygonX.clear();
|
||||
_polygonY.clear();
|
||||
_polygonZ.clear();
|
||||
update();
|
||||
}
|
||||
*/
|
||||
|
||||
//}
|
||||
//void RMFrameGraph::onPositionChanged(qint64 position,qint64 duration)
|
||||
//{
|
||||
// double pos = (double)MIN(position,duration);
|
||||
// double du = ((double)(duration));
|
||||
|
||||
// // 센서 값과 유사하게 표시하기위해 보정
|
||||
// //const double tolerance = 50.0;
|
||||
|
||||
// // 실제 시간과 seek duration 보정
|
||||
// //double pos2 = (pos + tolerance) * (_itemDurationMSec / du);
|
||||
// double pos2 = pos;
|
||||
|
||||
|
||||
|
||||
// unsigned int offset = (unsigned int)(((double)pos2) / ((double)du) * ((double)currentData->getSensorCount()) );
|
||||
|
||||
// if(offset < currentData->getSensorCount())
|
||||
// {
|
||||
// const float* sensorValues = currentData->getSensor();
|
||||
// const float x = sensorValues[(offset * NUM_SENSOR_DATA) + 0] * 2.0;
|
||||
// const float y = sensorValues[(offset * NUM_SENSOR_DATA) + 1] * 2.0;
|
||||
// const float z = sensorValues[(offset * NUM_SENSOR_DATA) + 2] * 2.0;
|
||||
// if(xLabel != NULL)
|
||||
// {
|
||||
// xLabel->setText(QString().sprintf("X:% .3f",x));
|
||||
// }
|
||||
// if(yLabel != NULL)
|
||||
// {
|
||||
// yLabel->setText(QString().sprintf("Y:% .3f",y));
|
||||
// }
|
||||
// if(zLabel != NULL)
|
||||
// {
|
||||
// zLabel->setText(QString().sprintf("Z:% .3f",z));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
Reference in New Issue
Block a user