MCPcopy Create free account
hub / github.com/OpenOrienteering/mapper / drawImpl

Method drawImpl

src/tools/edit_point_tool.cpp:604–650  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

602}
603
604void EditPointTool::drawImpl(QPainter* painter, MapWidget* widget)
605{
606 auto num_selected_objects = map()->selectedObjects().size();
607 if (num_selected_objects > 0)
608 {
609 drawSelectionOrPreviewObjects(painter, widget, bool(text_editor));
610
611 if (!text_editor)
612 {
613 Object* object = *map()->selectedObjectsBegin();
614 if (num_selected_objects == 1 &&
615 object->getType() == Object::Text &&
616 !object->asText()->hasSingleAnchor())
617 {
618 drawBoundingPath(painter, widget, object->asText()->controlPoints(), hover_state.testFlag(OverFrame) ? active_color : selection_color);
619 }
620 else if (selection_extent.isValid())
621 {
622 auto active = hover_state.testFlag(OverFrame) && !hover_state.testFlag(OverObjectNode);
623 drawBoundingBox(painter, widget, selection_extent, active ? active_color : selection_color);
624 }
625
626 if (num_selected_objects <= max_objects_for_handle_display)
627 {
628 for (const auto* object: map()->selectedObjects())
629 {
630 auto active = hover_state.testFlag(OverObjectNode) && hover_object == object;
631 auto hover_point = active ? this->hover_point : no_point;
632 pointHandles().draw(painter, widget, object, hover_point, true, PointHandles::NormalHandleState);
633 }
634 }
635 }
636 }
637
638 // Text editor
639 if (text_editor)
640 {
641 painter->save();
642 widget->applyMapTransform(painter);
643 text_editor->draw(painter, widget);
644 painter->restore();
645 }
646
647 // Box selection
648 if (isDragging() && box_selection)
649 drawSelectionBox(painter, widget, click_pos_map, cur_pos_map);
650}
651
652void EditPointTool::finishEditing()
653{

Callers

nothing calls this directly

Calls 11

selectedObjectsBeginMethod · 0.80
hasSingleAnchorMethod · 0.80
controlPointsMethod · 0.80
testFlagMethod · 0.80
applyMapTransformMethod · 0.80
sizeMethod · 0.45
getTypeMethod · 0.45
asTextMethod · 0.45
isValidMethod · 0.45
drawMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected