hipp  1.0
hipp/gui/HippLine.h
Go to the documentation of this file.
00001 /*
00002         Copyright 2011 Certec, Lund University, Sweden
00003 
00004     This file is part of HIPP.
00005 
00006     HIPP is free software: you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation, either version 3 of the License, or
00009     (at your option) any later version.
00010 
00011     HIPP is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with HIPP.  If not, see <http://www.gnu.org/licenses/>.
00018 
00019  */
00020 
00021 #ifndef __HIPPLINE_H__
00022 #define __HIPPLINE_H__
00023 
00024 #include <wx/docview.h>
00025 #include "HippShape.h"
00026 #include <xercesc/util/XMLString.hpp>
00027 #include <iostream>
00028 
00029 using namespace xercesc;
00030 using namespace std;
00031 namespace hipp {
00032 
00048 class HippLine: public HippShape {
00049 public:
00050         HippLine(void);
00051         ~HippLine(void);
00052 
00053         void LoadObject(const xercesc::Attributes& attrs, const XMLCh* const localname=XMLString::transcode("line"));
00054         ostream& SaveObject(ostream& stream);
00055 
00056         ShapeType getShapeType(){
00057                 return Line;
00058         }
00059 
00060         const wxRect& getBounds() const;
00061         bool containsPoint(wxPoint p) const;
00062         void OnDraw(Cairo::RefPtr<Cairo::Context> context, bool isHaptic = true) const;
00063         virtual HippLine* clone() const;
00064     void move(int diffX, int diffY);
00065     void zoom(int scaleX, int scaleY);
00066 
00067         wxPoint getP1() const;
00068         wxPoint getP2() const;
00069         bool isVertical() const;
00070         bool isHorizontal() const;
00071 
00072         void setP1(int x, int y);
00073         void setP2(int x, int y);
00074 
00075 private:
00076         wxPoint * p1;
00077         wxPoint * p2;
00078         void updateBoundingBox();
00079         wxRect boundingBox;
00080 };
00081 }
00082 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines