<commit_before>//
// This file is part of the Marble Desktop Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2007      <NAME> <<EMAIL>>
//


#include "GeoDataIconStyle.h"

#include <QtCore/QDebug>

GeoDataIconStyle::GeoDataIconStyle()
  : m_scale( 1.0 ),
    m_icon( QPixmap() ),
    m_hotSpot( new GeoDataHotSpot() )
{
}

GeoDataIconStyle::GeoDataIconStyle( const QPixmap& icon, const QPointF &hotSpot )
  : m_scale( 1.0 ),
    m_icon( icon ),
    m_hotSpot( new GeoDataHotSpot( hotSpot ) )
{
}

GeoDataIconStyle::~GeoDataIconStyle()
{
    delete m_hotSpot;
}

void GeoDataIconStyle::setIcon( const QPixmap &icon )
{
    m_icon = icon;
}

QPixmap GeoDataIconStyle::icon() const
{
    return m_icon;
}

void GeoDataIconStyle::setHotSpot( const QPointF& hotSpot, 
                                   GeoDataHotSpot::Units xunits,
                                   GeoDataHotSpot::Units yunits )
{
    m_hotSpot->setHotSpot( hotSpot, xunits, uunits );
}

const QPointF& GeoDataIconStyle::hotSpot() const // always in pixels, Origin upper left
{
    GeoDataHotSpot::Units xunits;
    GeoDataHotSpot::Units yunits;

    m_pixelHotSpot = m_hotSpot->hotSpot( xunits, yunits );

    if ( xunits == GeoDataHotSpot::Fraction )
        m_pixelHotSpot.setX( m_icon.width()  * m_pixelHotSpot.x() );
    else {
        if ( xunits == GeoDataHotSpot::InsetPixels )
            m_pixelHotSpot.setX( m_icon.width()  - m_pixelHotSpot.x() );
    }

    if ( yunits == GeoDataHotSpot::Fraction )
        m_pixelHotSpot.setY( m_icon.height() * ( 1.0 - m_pixelHotSpot.y() ) );<commit_msg>Fix bug caused by bugfix :-/<commit_after>//
// This file is part of the Marble Desktop Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2007      <NAME> <<EMAIL>>
//


#include "GeoDataIconStyle.h"

#include <QtCore/QDebug>

GeoDataIconStyle::GeoDataIconStyle()
  : m_scale( 1.0 ),
    m_icon( QPixmap() ),
    m_hotSpot( new GeoDataHotSpot() )
{
}

GeoDataIconStyle::GeoDataIconStyle( const QPixmap& icon, const QPointF &hotSpot )
  : m_scale( 1.0 ),
    m_icon( icon ),
    m_hotSpot( new GeoDataHotSpot( hotSpot ) )
{
}

GeoDataIconStyle::~GeoDataIconStyle()
{
    delete m_hotSpot;
}

void GeoDataIconStyle::setIcon( const QPixmap &icon )
{
    m_icon = icon;
}

QPixmap GeoDataIconStyle::icon() const
{
    return m_icon;
}

void GeoDataIconStyle::setHotSpot( const QPointF& hotSpot, 
                                   GeoDataHotSpot::Units xunits,
                                   GeoDataHotSpot::Units yunits )
{
    m_hotSpot->setHotSpot( hotSpot, xunits, yunits );
}

const QPointF& GeoDataIconStyle::hotSpot() const // always in pixels, Origin upper left
{
    GeoDataHotSpot::Units xunits;
    GeoDataHotSpot::Units yunits;

    m_pixelHotSpot = m_hotSpot->hotSpot( xunits, yunits );

    if ( xunits == GeoDataHotSpot::Fraction )
        m_pixelHotSpot.setX( m_icon.width()  * m_pixelHotSpot.x() );
    else {
        if ( xunits == GeoDataHotSpot::InsetPixels )
            m_pixelHotSpot.setX( m_icon.width()  - m_pixelHotSpot.x() );
    }

    if ( yunits == GeoDataHotSpot::Fraction )
        m_pixelHotSpot.setY( m_icon.height() * ( 1.0 - m_pixelHotSpot.y() ) );
{'fraction_non_alphanumeric': 0.11941605839416058, 'fraction_numerical': 0.00583941605839416, 'mean_word_length': 2.993006993006993, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '920863', 'n_tokens_mistral': 1307, 'n_tokens_neox': 1199, 'n_words': 275}