00001 //--------------------------------------------------------------------------- 00002 // 00003 // File: TxqDoublePoint.h 00004 // 00005 // Purpose: a double point class 00006 // 00007 // Version: $Id: TxqDoublePoint.h,v 1.5 2001/10/12 18:51:23 kgl Exp $ 00008 // 00009 // modified from the TxDoublePoint.java class: 00010 // Project: Tech-X Foundation Classes 00011 // David A. Alexander, Svetlana G. Shasharina, John R. Cary 00012 // Copyright (C) 1998-2000 Tech-X Corporation. All Rights Reserved. 00013 //--------------------------------------------------------------------------- 00014 00015 #ifndef TXQ_DOUBLEPOINT_H 00016 #define TXQ_DOUBLEPOINT_H 00017 00018 // Qt includes 00019 #include <qpoint.h> 00020 00025 class TxqDoublePoint 00026 { 00027 00028 public: 00029 00034 TxqDoublePoint() { 00035 TxqDoublePoint(0, 0); 00036 } 00037 00043 TxqDoublePoint(QPoint p) { 00044 TxqDoublePoint(p.x(), p.y()); 00045 } 00046 00053 TxqDoublePoint(int x, int y) { 00054 setX(x); 00055 setY(y); 00056 } 00057 00064 TxqDoublePoint(double x, double y) { 00065 setX(x); 00066 setY(y); 00067 } 00068 00074 void setX(double value) { 00075 dblx = value; 00076 intx = (int)(value+0.5); 00077 } 00078 00084 void setX(int value) { 00085 dblx = (double)value; 00086 intx = value; 00087 } 00088 00094 void setY(double value) { 00095 dbly = value; 00096 inty = (int)(value+0.5); 00097 } 00098 00104 void setY(int value) { 00105 dbly = (double)value; 00106 inty = value; 00107 } 00108 00113 double getDblx() { 00114 return dblx; 00115 } 00116 00121 int getIntx() { 00122 return intx; 00123 } 00124 00129 double getDbly() { 00130 return dbly; 00131 } 00132 00137 int getInty() { 00138 return inty; 00139 } 00140 00147 void translate(double dx, double dy) { 00148 dblx += dx; 00149 dbly += dy; 00150 intx = (int)(dblx+.5); 00151 inty = (int)(dbly+.5); 00152 } 00153 00160 void translate(int dx, int dy) { 00161 dblx += (double)dx; 00162 dbly += (double)dy; 00163 intx += dx; 00164 inty += dy; 00165 } 00166 00170 virtual ~TxqDoublePoint(){} 00171 00175 double dblx; 00176 00180 double dbly; 00181 00185 int intx; 00186 00190 int inty; 00191 00192 00193 }; 00194 #endif
Copyright Tech-X Corporation, all rights reserved.