/***************************************************************************
 *   Copyright (C) 2008 by Peter Dahlberg   *
 *   pdahlberg@gmail.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef HOMOBFIELDITEM_H
#define HOMOBFIELDITEM_H

#include <fielditem.h>

/**
	@author Peter Dahlberg <pdahlberg@gmail.com>
*/
class HomoBFieldWidget;
class QWidget;
class HomoBFieldItem : public FieldItem {
	Q_OBJECT
	public:
		enum {Type = UserType + 2};
		enum {MinimumWidth = 20};
		enum {MinimumHeight = 30};
  		
		HomoBFieldItem(QRectF sizeRect);

   		virtual ~HomoBFieldItem();

		virtual QRectF boundingRect() const;
    		virtual QRectF getRectF() const;
    		virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
		virtual bool contains(const QPointF point);		

		int type() const;

		int getFieldLineDistance() const;
		QWidget* getDockWidget() const;
		
		double getOuterPenWidth() const;
		bool getIsDirectionIntoPlane() const;
		double getFluxDensity() const;

		QList<QVariant> getSaveDataList();
		void setSaveDataList(QList<QVariant> list);

	public slots:
		void setOuterPenWidth ( double theValue );
		void setFieldLineDistance ( int theValue );
		void setIsDirectionIntoPlane ( bool theValue );
		void setFluxDensity ( double theValue );
	

	signals:
		void directionChanged(bool theValue);
		void fluxDensityChanged(double theValue);

	private:
		//! Abstand der Feldlinien in der Zeichnung
		int fieldLineDistance;

		double outerPenWidth;

		//! Gibt an, ob das Feld in die Ebene Zeigt oder heraus (true == in die Ebene hinein)
		bool isDirectionIntoPlane;

		HomoBFieldWidget* dockWidget;
		
		///! Enth&auml;t die Magnetische Flussdichte B in Tesla
		double fluxDensity;



protected:
   		void wheelEvent ( QGraphicsSceneWheelEvent * event );
};

#endif
