mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-18 08:54:15 +01:00
OP-532 Implemented scalling of swashplate image in GUI
This commit is contained in:
parent
97c22fb57c
commit
56050b0536
@ -70,7 +70,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>400</width>
|
<width>300</width>
|
||||||
<height>300</height>
|
<height>300</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -1105,14 +1105,14 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>200</width>
|
<width>10</width>
|
||||||
<height>200</height>
|
<height>10</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>500</width>
|
<width>1000</width>
|
||||||
<height>500</height>
|
<height>1000</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeIncrement">
|
<property name="sizeIncrement">
|
||||||
@ -2469,14 +2469,14 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>200</width>
|
<width>10</width>
|
||||||
<height>200</height>
|
<height>10</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>500</width>
|
<width>1000</width>
|
||||||
<height>500</height>
|
<height>1000</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeIncrement">
|
<property name="sizeIncrement">
|
||||||
|
@ -58,12 +58,12 @@ ConfigccpmWidget::ConfigccpmWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
|||||||
m_ccpm->SwashplateImage->setScene(new QGraphicsScene(this));
|
m_ccpm->SwashplateImage->setScene(new QGraphicsScene(this));
|
||||||
|
|
||||||
m_ccpm->SwashLvlSwashplateImage->setScene(m_ccpm->SwashplateImage->scene());
|
m_ccpm->SwashLvlSwashplateImage->setScene(m_ccpm->SwashplateImage->scene());
|
||||||
m_ccpm->SwashLvlSwashplateImage->setSceneRect(-50,-30,500,500);
|
m_ccpm->SwashLvlSwashplateImage->setSceneRect(-50,-50,500,500);
|
||||||
m_ccpm->SwashLvlSwashplateImage->scale(.85,.85);
|
//m_ccpm->SwashLvlSwashplateImage->scale(.85,.85);
|
||||||
|
|
||||||
//m_ccpm->SwashplateImage->setSceneRect(SwashplateImg->boundingRect());
|
//m_ccpm->SwashplateImage->setSceneRect(SwashplateImg->boundingRect());
|
||||||
m_ccpm->SwashplateImage->setSceneRect(-50,-30,500,500);
|
m_ccpm->SwashplateImage->setSceneRect(-50,-30,500,500);
|
||||||
m_ccpm->SwashplateImage->scale(.85,.85);
|
//m_ccpm->SwashplateImage->scale(.85,.85);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ ConfigccpmWidget::ConfigccpmWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ccpmSwashplateRedraw();
|
||||||
// connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestccpmUpdate()));
|
// connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestccpmUpdate()));
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -433,7 +433,7 @@ void ConfigccpmWidget::UpdateType()
|
|||||||
|
|
||||||
//update UI
|
//update UI
|
||||||
ccpmSwashplateUpdate();
|
ccpmSwashplateUpdate();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -730,13 +730,33 @@ void ConfigccpmWidget::ccpmSwashplateRedraw()
|
|||||||
{
|
{
|
||||||
double angle[CCPM_MAX_SWASH_SERVOS],CorrectionAngle,x,y,w,h,radius,CenterX,CenterY;
|
double angle[CCPM_MAX_SWASH_SERVOS],CorrectionAngle,x,y,w,h,radius,CenterX,CenterY;
|
||||||
int used[CCPM_MAX_SWASH_SERVOS],defined[CCPM_MAX_SWASH_SERVOS],i;
|
int used[CCPM_MAX_SWASH_SERVOS],defined[CCPM_MAX_SWASH_SERVOS],i;
|
||||||
|
|
||||||
|
QRect size;
|
||||||
|
double scale,xscale,yscale;
|
||||||
|
|
||||||
|
|
||||||
|
size = m_ccpm->SwashplateImage->rect();
|
||||||
|
xscale=size.width();
|
||||||
|
yscale=size.height();
|
||||||
|
scale=xscale;
|
||||||
|
if (yscale<scale)scale=yscale;
|
||||||
|
scale/=460.00;
|
||||||
|
m_ccpm->SwashplateImage->resetTransform ();
|
||||||
|
m_ccpm->SwashplateImage->scale(scale,scale);
|
||||||
|
|
||||||
|
size = m_ccpm->SwashLvlSwashplateImage->rect();
|
||||||
|
xscale=size.width();
|
||||||
|
yscale=size.height();
|
||||||
|
scale=xscale;
|
||||||
|
if (yscale<scale)scale=yscale;
|
||||||
|
scale/=590.00;
|
||||||
|
m_ccpm->SwashLvlSwashplateImage->resetTransform ();
|
||||||
|
m_ccpm->SwashLvlSwashplateImage->scale(scale,scale);
|
||||||
|
|
||||||
CorrectionAngle=m_ccpm->ccpmCorrectionAngle->value();
|
CorrectionAngle=m_ccpm->ccpmCorrectionAngle->value();
|
||||||
|
|
||||||
//CenterX=m_ccpm->SwashplateImage->scene()->sceneRect().center().x();
|
|
||||||
// CenterY=m_ccpm->SwashplateImage->scene()->sceneRect().center().y();
|
|
||||||
CenterX=200;
|
CenterX=200;
|
||||||
CenterY=220;
|
CenterY=200;
|
||||||
|
|
||||||
SwashplateImg->setPos(CenterX-200,CenterY-200);
|
SwashplateImg->setPos(CenterX-200,CenterY-200);
|
||||||
|
|
||||||
@ -1563,6 +1583,7 @@ void ConfigccpmWidget::showEvent(QShowEvent *event)
|
|||||||
m_ccpm->ccpmAdvancedSettingsTable->setColumnWidth(i,(m_ccpm->ccpmAdvancedSettingsTable->width()-
|
m_ccpm->ccpmAdvancedSettingsTable->setColumnWidth(i,(m_ccpm->ccpmAdvancedSettingsTable->width()-
|
||||||
m_ccpm->ccpmAdvancedSettingsTable->verticalHeader()->width())/6);
|
m_ccpm->ccpmAdvancedSettingsTable->verticalHeader()->width())/6);
|
||||||
}
|
}
|
||||||
|
ccpmSwashplateRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user