update
This commit is contained in:
parent
03512aae5b
commit
306a7ee38d
|
|
@ -64,12 +64,19 @@
|
|||
<LibraryPath>$(SolutionDir)$(Platform)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<IncludePath>$(SolutionDir)MapPresent;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)$(Platform)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>MapPresent.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>MapPresent.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
|
||||
<ClCompile>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ MapPresent::MapPresent(QWidget* parent /*= nullptr*/)
|
|||
PresentIndex MapPresent::indexGet(const QPointF& pos) const
|
||||
{
|
||||
QList<PresentOption> templist;
|
||||
for (auto unit_g : _visible_units) {
|
||||
for (auto unit_g : _visible_unit_groups) {
|
||||
while (unit_g) {
|
||||
auto unit = unit_g->optionGet();
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ QRectF MapPresent::outlineGet(const PresentIndex& idx) const
|
|||
auto widget_rect = this->rect();
|
||||
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 n_yinc = 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];
|
||||
|
||||
QPainter p(this);
|
||||
for (auto opt_g : _visible_units) {
|
||||
for (auto opt_g : _visible_unit_groups) {
|
||||
while (opt_g) {
|
||||
p.save();
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ void MapPresent::resizeEvent(QResizeEvent* event)
|
|||
{
|
||||
QWidget::resizeEvent(event);
|
||||
|
||||
visibleUnitsTidy();
|
||||
visible_units_tidy();
|
||||
}
|
||||
|
||||
void MapPresent::mouseMoveEvent(QMouseEvent* event)
|
||||
|
|
@ -164,11 +164,11 @@ PresentOption AssumeOpt(PresentIndex index, QRectF rf) {
|
|||
return opt;
|
||||
}
|
||||
|
||||
void MapPresent::visibleUnitsTidy() {
|
||||
_visible_units.clear();
|
||||
void MapPresent::visible_units_tidy() {
|
||||
_visible_unit_groups.clear();
|
||||
|
||||
QRectF curr_outline = this->rect();
|
||||
_visible_units << std::make_shared<OptionGroup>(
|
||||
_visible_unit_groups << std::make_shared<OptionGroup>(
|
||||
AssumeOpt(_center_index, outlineGet(_center_index))
|
||||
);
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ void MapPresent::visibleUnitsTidy() {
|
|||
}
|
||||
|
||||
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) {
|
||||
auto ap = e6_points[idx];
|
||||
auto bp = e6_points[idx + 1];
|
||||
values << itemFills(ap, bp);
|
||||
values << item_supply(ap, bp);
|
||||
}
|
||||
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;
|
||||
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>
|
||||
const float _primitive_region_square_len = 100;
|
||||
const float _primitive_region_len = 100;
|
||||
/// <summary>
|
||||
/// 缩放倍数
|
||||
/// </summary>
|
||||
|
|
@ -91,11 +91,10 @@ private:
|
|||
PresentIndex _center_index;
|
||||
|
||||
// ===================================
|
||||
QList<std::shared_ptr<OptionGroup>> _visible_units;
|
||||
void visibleUnitsTidy();
|
||||
QList<std::shared_ptr<OptionGroup>> _visible_unit_groups;
|
||||
void visible_units_tidy();
|
||||
|
||||
QList<PresentIndex> siblingsGet(const PresentIndex& center, uint16_t dist = 1) const;
|
||||
QList<PresentIndex> itemFills(const PresentIndex& a, const PresentIndex& b) const;
|
||||
QList<PresentIndex> item_supply(const PresentIndex& a, const PresentIndex& b) const;
|
||||
|
||||
// ===================================
|
||||
QHash<int, UnitPresentDelegate*> _present_delegate;
|
||||
|
|
@ -116,6 +115,13 @@ public:
|
|||
/// <param name="idx"></param>
|
||||
/// <returns></returns>
|
||||
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:
|
||||
void mouseIn();
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
|
||||
<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>
|
||||
</PropertyGroup>
|
||||
<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(1, Qt::white);
|
||||
p->setBrush(brush);
|
||||
p->drawRect(rect);
|
||||
|
||||
auto pathx = clipPathGet(rect);
|
||||
if (_hot_index == option.index) {
|
||||
auto pen = p->pen();
|
||||
pen.setColor(Qt::red);
|
||||
pen.setWidth(10);
|
||||
p->setPen(pen);
|
||||
auto pathx = clipPathGet(rect);
|
||||
p->drawPath(pathx);
|
||||
}
|
||||
p->drawPath(pathx);
|
||||
|
||||
auto ft = p->font();
|
||||
ft.setPixelSize(alen * 0.3);
|
||||
|
|
|
|||
Loading…
Reference in New Issue