File indexing completed on 2024-05-05 03:50:40

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2014 Calin Cruceru <crucerucalincristian@gmail.com>
0004 //
0005 
0006 #include "PolylineNode.h"
0007 
0008 namespace Marble
0009 {
0010 
0011 PolylineNode::PolylineNode( const QRegion& region ) :
0012     m_region( region  ),
0013     m_flags( PolyNodeFlags() )
0014 {
0015     // nothing to do
0016 }
0017 
0018 PolylineNode::~PolylineNode()
0019 {
0020     // nothing to do
0021 }
0022 
0023 bool PolylineNode::isSelected() const
0024 {
0025     return m_flags & NodeIsSelected;
0026 }
0027 
0028 bool PolylineNode::isBeingMerged() const
0029 {
0030     return m_flags & NodeIsMerged;
0031 }
0032 
0033 bool PolylineNode::isEditingHighlighted() const
0034 {
0035     return m_flags & NodeIsEditingHighlighted;
0036 }
0037 
0038 bool PolylineNode::isMergingHighlighted() const
0039 {
0040     return m_flags & NodeIsMergingHighlighted;
0041 }
0042 
0043 void PolylineNode::setRegion( const QRegion& newRegion )
0044 {
0045     m_region = newRegion;
0046 }
0047 
0048 PolylineNode::PolyNodeFlags PolylineNode::flags() const
0049 {
0050     return m_flags;
0051 }
0052 
0053 void PolylineNode::setFlag( PolyNodeFlag flag, bool enabled )
0054 {
0055     if ( enabled ) {
0056         m_flags |= flag;
0057     } else {
0058         m_flags &= ~flag;
0059     }
0060 }
0061 
0062 void PolylineNode::setFlags( PolyNodeFlags flags )
0063 {
0064     m_flags = flags;
0065 }
0066 
0067 bool PolylineNode::containsPoint( const QPoint &eventPos ) const
0068 {
0069     return m_region.contains( eventPos );
0070 }
0071 
0072 }