Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » Scatter: Propose to add new methods
Scatter: Propose to add new methods [message #28570] Tue, 07 September 2010 16:26 Go to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

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 #28581 is a reply to message #28570] Tue, 07 September 2010 23:27 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Hello Ion

You read my mind Smile. 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);
}



Best regards
Iñaki
Re: Scatter: Propose to add new methods [message #28585 is a reply to message #28581] Wed, 08 September 2010 07:46 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

It is perfect!

koldo wrote on Wed, 08 September 2010 00:27

Hello Ion

You read my mind Smile. 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 #28643 is a reply to message #28585] Thu, 09 September 2010 09:25 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Hello Ion

Only one condition: Could you post here the description of these functions to be included in the help? Smile


Best regards
Iñaki
Re: Scatter: Propose to add new methods [message #28658 is a reply to message #28643] Thu, 09 September 2010 15:54 Go to previous message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

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? Smile


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.


Previous Topic: Docking: How to dock to the entire portion of what remains?
Next Topic: Scatter : getDrawing !!!! help !!!!
Goto Forum:
  


Current Time: Thu Mar 28 09:57:42 CET 2024

Total time taken to generate the page: 0.01233 seconds