|
|
Home » Developing U++ » UppHub » Scatter: Propose to add new methods
Scatter: Propose to add new methods [message #28570] |
Tue, 07 September 2010 16:26 |
|
Hello All,
I propose to add the following new public methods and integrate in scatter control:
double Scatter::GetXByPoint(const Point &p_point){
double v_x=(p_point.x-GetH_Border())*GetXRange()/(GetSize().cx-2*GetH_Border()-1)+GetXMin();
return v_x;
}
double Scatter::GetYByPoint(const Point &p_point){
double v_y=(GetSize().cy-GetV_Border()-p_point.y-1)*GetYRange()/(GetSize().cy-2*GetV_Border()-GetTitleFont().GetHeight()-1)+GetYMin();
return v_y;
}
double Scatter::GetY2ByPoint(const Point &p_point){
double v_y2=(GetSize().cy-GetV_Border()-p_point.y-1)*GetY2Range()/(GetSize().cy-2*GetV_Border()-GetTitleFont().GetHeight()-1)+GetYMin2();
return v_y2;
}
double Scatter::GetXPointByValue(const XY &p_v){
double v_x=(p_v.x-GetXMin())/GetXRange()*(GetSize().cx-2*GetH_Border()-1)+GetH_Border();
return v_x;
}
double Scatter::GetYPointByValue(const XY &p_v){
double v_y=(GetSize().cy-GetV_Border()-1)-(p_v.y-GetYMin())/GetYRange()*(GetSize().cy-2*GetV_Border()-GetTitleFont().GetHeight()-1);
return v_y;
}
and propose to modify method:
from:
Scatter &Scatter::SetMinUnits(double ux, double uy)
{
xMinUnit=ux;
yMinUnit=uy;
yMinUnit2=yRange2*yMinUnit/yRange;
return *this;
}
to:
Scatter &Scatter::SetMinUnits(double ux, double uy)
{
xMinUnit=ux;
yMinUnit=uy;
yMinUnit2=yRange2*yMinUnit/yRange;
AdjustMinUnitX();
AdjustMinUnitY();
AdjustMinUnitY2();
return *this;
}
I use this methods very often.
Best regards, Ion Lupascu.
|
|
|
|
Re: Scatter: Propose to add new methods [message #28585 is a reply to message #28581] |
Wed, 08 September 2010 07:46 |
|
It is perfect!
koldo wrote on Wed, 08 September 2010 00:27 | Hello Ion
You read my mind . I like them.
And this?:
double Scatter::GetXByPoint(const int x){
return (x-GetH_Border())*GetXRange()/(GetSize().cx-2*GetH_Border()-1)+GetXMin();
}
double Scatter::GetYByPoint(const int y){
return (GetSize().cy-GetV_Border()-y-1)*GetYRange()/(GetSize().cy-2*GetV_Border()-GetTitleFont().GetHeight()-1)+GetYMin();
}
double Scatter::GetY2ByPoint(const int y){
return (GetSize().cy-GetV_Border()-y-1)*GetY2Range()/(GetSize().cy-2*GetV_Border()-GetTitleFont().GetHeight()-1)+GetYMin2();
}
double Scatter::GetXPointByValue(const double x){
return x-GetXMin())/GetXRange()*(GetSize().cx-2*GetH_Border()-1)+GetH_Border();
}
double Scatter::GetYPointByValue(const double y){
return (GetSize().cy-GetV_Border()-1)-(y-GetYMin())/GetYRange()*(GetSize().cy-2*GetV_Border()-GetTitleFont().GetHeight()-1);
}
|
|
|
|
|
Re: Scatter: Propose to add new methods [message #28658 is a reply to message #28643] |
Thu, 09 September 2010 15:54 |
|
koldo wrote on Thu, 09 September 2010 10:25 | Hello Ion
Only one condition: Could you post here the description of these functions to be included in the help?
|
Quote: | double Scatter::GetXByPoint(const int x)
double Scatter::GetYByPoint(const int y)
double Scatter::GetY2ByPoint(const int y)
This methods will return the X, Y and Y2 values by x/y point position. The x point position can be retrieved from parameter pt of the following events:
virtual void Scatter::LeftDown(Point pt, ..),
virtual void Scatter::RightDown(Point pt, ..),
virtual void Scatter::MouseWheel(Point pt, ..), and other control mouse events
double Scatter::GetXPointByValue(const double x)
double Scatter::GetYPointByValue(const double y)
This methods will return the x, y position in dots on Scatter control by X, Y Values. This methods are vice-versa of:
double Scatter::GetXByPoint(const int x)
double Scatter::GetYByPoint(const int y)
|
Please correct and imporve the description of this methods is is not OK.
Ion.
|
|
|
Goto Forum:
Current Time: Fri Sep 20 21:52:44 CEST 2024
Total time taken to generate the page: 0.02807 seconds
|
|
|