update
This commit is contained in:
parent
03512aae5b
commit
306a7ee38d
|
|
@ -64,12 +64,19 @@
|
||||||
<LibraryPath>$(SolutionDir)$(Platform)\$(Configuration);$(LibraryPath)</LibraryPath>
|
<LibraryPath>$(SolutionDir)$(Platform)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||||
|
<IncludePath>$(SolutionDir)MapPresent;$(IncludePath)</IncludePath>
|
||||||
|
<LibraryPath>$(SolutionDir)$(Platform)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>MapPresent.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>MapPresent.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Link>
|
||||||
|
<AdditionalDependencies>MapPresent.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ MapPresent::MapPresent(QWidget* parent /*= nullptr*/)
|
||||||
PresentIndex MapPresent::indexGet(const QPointF& pos) const
|
PresentIndex MapPresent::indexGet(const QPointF& pos) const
|
||||||
{
|
{
|
||||||
QList<PresentOption> templist;
|
QList<PresentOption> templist;
|
||||||
for (auto unit_g : _visible_units) {
|
for (auto unit_g : _visible_unit_groups) {
|
||||||
while (unit_g) {
|
while (unit_g) {
|
||||||
auto unit = unit_g->optionGet();
|
auto unit = unit_g->optionGet();
|
||||||
|
|
||||||
|
|
@ -82,7 +82,7 @@ QRectF MapPresent::outlineGet(const PresentIndex& idx) const
|
||||||
auto widget_rect = this->rect();
|
auto widget_rect = this->rect();
|
||||||
auto widget_center = widget_rect.center();
|
auto widget_center = widget_rect.center();
|
||||||
|
|
||||||
const float ap_len = _primitive_region_square_len / 2;
|
const float ap_len = _primitive_region_len / 2;
|
||||||
auto a2_vec = ap_len * sqrt(3) / 2;
|
auto a2_vec = ap_len * sqrt(3) / 2;
|
||||||
auto n_yinc = QVector3D(a2_vec, ap_len * 3 / 2, 0);
|
auto n_yinc = QVector3D(a2_vec, ap_len * 3 / 2, 0);
|
||||||
auto n_xinc = QVector3D(a2_vec, -ap_len * 3 / 2, 0);
|
auto n_xinc = QVector3D(a2_vec, -ap_len * 3 / 2, 0);
|
||||||
|
|
@ -103,7 +103,7 @@ void MapPresent::paintEvent(QPaintEvent* ev)
|
||||||
UnitPresentDelegate& t = *_present_delegate[0];
|
UnitPresentDelegate& t = *_present_delegate[0];
|
||||||
|
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
for (auto opt_g : _visible_units) {
|
for (auto opt_g : _visible_unit_groups) {
|
||||||
while (opt_g) {
|
while (opt_g) {
|
||||||
p.save();
|
p.save();
|
||||||
|
|
||||||
|
|
@ -129,7 +129,7 @@ void MapPresent::resizeEvent(QResizeEvent* event)
|
||||||
{
|
{
|
||||||
QWidget::resizeEvent(event);
|
QWidget::resizeEvent(event);
|
||||||
|
|
||||||
visibleUnitsTidy();
|
visible_units_tidy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapPresent::mouseMoveEvent(QMouseEvent* event)
|
void MapPresent::mouseMoveEvent(QMouseEvent* event)
|
||||||
|
|
@ -164,11 +164,11 @@ PresentOption AssumeOpt(PresentIndex index, QRectF rf) {
|
||||||
return opt;
|
return opt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapPresent::visibleUnitsTidy() {
|
void MapPresent::visible_units_tidy() {
|
||||||
_visible_units.clear();
|
_visible_unit_groups.clear();
|
||||||
|
|
||||||
QRectF curr_outline = this->rect();
|
QRectF curr_outline = this->rect();
|
||||||
_visible_units << std::make_shared<OptionGroup>(
|
_visible_unit_groups << std::make_shared<OptionGroup>(
|
||||||
AssumeOpt(_center_index, outlineGet(_center_index))
|
AssumeOpt(_center_index, outlineGet(_center_index))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -187,7 +187,7 @@ void MapPresent::visibleUnitsTidy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prev_g) {
|
if (prev_g) {
|
||||||
_visible_units << prev_g;
|
_visible_unit_groups << prev_g;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -209,12 +209,12 @@ QList<PresentIndex> MapPresent::siblingsGet(const PresentIndex& center, uint16_t
|
||||||
for (auto idx = 0; idx < 6; ++idx) {
|
for (auto idx = 0; idx < 6; ++idx) {
|
||||||
auto ap = e6_points[idx];
|
auto ap = e6_points[idx];
|
||||||
auto bp = e6_points[idx + 1];
|
auto bp = e6_points[idx + 1];
|
||||||
values << itemFills(ap, bp);
|
values << item_supply(ap, bp);
|
||||||
}
|
}
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<PresentIndex> MapPresent::itemFills(const PresentIndex& a, const PresentIndex& b) const
|
QList<PresentIndex> MapPresent::item_supply(const PresentIndex& a, const PresentIndex& b) const
|
||||||
{
|
{
|
||||||
QList<PresentIndex> items;
|
QList<PresentIndex> items;
|
||||||
auto sign_row = (a.row == b.row) ? 0 : ((b.row - a.row) / std::abs(a.row - b.row));
|
auto sign_row = (a.row == b.row) ? 0 : ((b.row - a.row) / std::abs(a.row - b.row));
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ private:
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 初级区域矩形变长
|
/// 初级区域矩形变长
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const float _primitive_region_square_len = 100;
|
const float _primitive_region_len = 100;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 缩放倍数
|
/// 缩放倍数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -91,11 +91,10 @@ private:
|
||||||
PresentIndex _center_index;
|
PresentIndex _center_index;
|
||||||
|
|
||||||
// ===================================
|
// ===================================
|
||||||
QList<std::shared_ptr<OptionGroup>> _visible_units;
|
QList<std::shared_ptr<OptionGroup>> _visible_unit_groups;
|
||||||
void visibleUnitsTidy();
|
void visible_units_tidy();
|
||||||
|
|
||||||
QList<PresentIndex> siblingsGet(const PresentIndex& center, uint16_t dist = 1) const;
|
QList<PresentIndex> item_supply(const PresentIndex& a, const PresentIndex& b) const;
|
||||||
QList<PresentIndex> itemFills(const PresentIndex& a, const PresentIndex& b) const;
|
|
||||||
|
|
||||||
// ===================================
|
// ===================================
|
||||||
QHash<int, UnitPresentDelegate*> _present_delegate;
|
QHash<int, UnitPresentDelegate*> _present_delegate;
|
||||||
|
|
@ -116,6 +115,13 @@ public:
|
||||||
/// <param name="idx"></param>
|
/// <param name="idx"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
QRectF outlineGet(const PresentIndex& idx) const;
|
QRectF outlineGet(const PresentIndex& idx) const;
|
||||||
|
/// <summary>
|
||||||
|
/// 삿혤鷺鍋관범데禱
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="center">뵙懃데禱乞多</param>
|
||||||
|
/// <param name="dist">데禱약잼</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
QList<PresentIndex> siblingsGet(const PresentIndex& center, uint16_t dist = 1) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void mouseIn();
|
void mouseIn();
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
|
||||||
<QtInstall>5.12.11_msvc2017_64</QtInstall>
|
<QtInstall>5.12.11_msvc2017_64</QtInstall>
|
||||||
<QtModules>core</QtModules>
|
<QtModules>core;xml;sql;gui;widgets;3dcore;3danimation;3dextras;3dinput;3dlogic;3drender</QtModules>
|
||||||
<QtBuildConfig>release</QtBuildConfig>
|
<QtBuildConfig>release</QtBuildConfig>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
|
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
|
||||||
|
|
|
||||||
|
|
@ -23,15 +23,16 @@ void BasicUnitDelegate::paint(QPainter* p, const PresentOption& option)
|
||||||
brush.setColorAt(0, Qt::gray);
|
brush.setColorAt(0, Qt::gray);
|
||||||
brush.setColorAt(1, Qt::white);
|
brush.setColorAt(1, Qt::white);
|
||||||
p->setBrush(brush);
|
p->setBrush(brush);
|
||||||
|
p->drawRect(rect);
|
||||||
|
|
||||||
auto pathx = clipPathGet(rect);
|
|
||||||
if (_hot_index == option.index) {
|
if (_hot_index == option.index) {
|
||||||
auto pen = p->pen();
|
auto pen = p->pen();
|
||||||
pen.setColor(Qt::red);
|
pen.setColor(Qt::red);
|
||||||
pen.setWidth(10);
|
pen.setWidth(10);
|
||||||
p->setPen(pen);
|
p->setPen(pen);
|
||||||
|
auto pathx = clipPathGet(rect);
|
||||||
|
p->drawPath(pathx);
|
||||||
}
|
}
|
||||||
p->drawPath(pathx);
|
|
||||||
|
|
||||||
auto ft = p->font();
|
auto ft = p->font();
|
||||||
ft.setPixelSize(alen * 0.3);
|
ft.setPixelSize(alen * 0.3);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue