渲染修正
This commit is contained in:
parent
25f73007f8
commit
bc6acbbcc9
|
|
@ -12,7 +12,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
MapPresent p;
|
MapPresent p;
|
||||||
p.show();
|
p.show();
|
||||||
p.zoomTo(0);
|
p.zoomTo(0.5);
|
||||||
|
|
||||||
//QObject::connect(&p, &MapPresent::mouseIn, [=]() {
|
//QObject::connect(&p, &MapPresent::mouseIn, [=]() {
|
||||||
// qDebug() << "Mouse Enter";
|
// qDebug() << "Mouse Enter";
|
||||||
|
|
|
||||||
|
|
@ -127,20 +127,24 @@ void MapPresent::paintEvent(QPaintEvent* ev)
|
||||||
for (auto unit_idx : _updated_index_list.mid(0, update_batch_count)) {
|
for (auto unit_idx : _updated_index_list.mid(0, update_batch_count)) {
|
||||||
pic_painter.save();
|
pic_painter.save();
|
||||||
|
|
||||||
|
// 原点偏移,绘制缩放
|
||||||
auto opt = _visible_units[unit_idx];
|
auto opt = _visible_units[unit_idx];
|
||||||
auto rect = opt.outline;
|
pic_painter.translate(opt.outline.topLeft());
|
||||||
pic_painter.translate(rect.topLeft());
|
pic_painter.scale(_scale_times, _scale_times);
|
||||||
rect.moveTo(0, 0);
|
|
||||||
|
|
||||||
|
// PresentOption重组,ClipPath设置
|
||||||
|
auto rect = QRectF(0, 0, _primitive_region_len, _primitive_region_len);
|
||||||
|
opt.outline = rect;
|
||||||
auto clip_path = BasicUnitDelegate::clipPathGet(rect);
|
auto clip_path = BasicUnitDelegate::clipPathGet(rect);
|
||||||
pic_painter.setClipPath(clip_path);
|
pic_painter.setClipPath(clip_path);
|
||||||
|
|
||||||
opt.outline = rect;
|
|
||||||
|
|
||||||
int unit_type = 0;
|
int unit_type = 0;
|
||||||
if (_map_data_model) {
|
if (_map_data_model) {
|
||||||
unit_type = _map_data_model->mapData(MapDataModel::DataType::UnitType, unit_idx).toInt();
|
unit_type = _map_data_model->mapData(MapDataModel::DataType::UnitType, unit_idx).toInt();
|
||||||
}
|
}
|
||||||
|
if (!_type_present_delegate.contains(unit_type)) {
|
||||||
|
unit_type = 0;
|
||||||
|
}
|
||||||
|
|
||||||
UnitPresentDelegate& t = *_type_present_delegate[unit_type];
|
UnitPresentDelegate& t = *_type_present_delegate[unit_type];
|
||||||
t.paint(&pic_painter, opt);
|
t.paint(&pic_painter, opt);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue