[Openroad-users] FW: Clickpoint problems with SegmentShape

gareth.2.edwards at bt.com gareth.2.edwards at bt.com
Thu Oct 18 01:41:30 EST 2007


I'm interested.  :o)
 
Cheers, 
Gareth Edwards 

BT Global Services 
tel: +44 (0)131 345 4671 
email: gareth.2.edwards at bt.com <mailto:daryn.piper at bt.com>  

 


________________________________

	From: openroad-users-bounces at peerlessit.com
[mailto:openroad-users-bounces at peerlessit.com] On Behalf Of Paul White
	Sent: Wednesday, October 17, 2007 4:26 PM
	To: International OpenROAD Users
	Subject: [Openroad-users] FW: Clickpoint problems with
SegmentShape
	
	
	From: Robert Allely  
	Sent: Wednesday, 17 October 2007 10:09 AM
	To: International OpenROAD Users
	Subject: RE: [Openroad-users] Clickpoint problems with
SegmentShape
	
	Hi
	 
	If anyone wants it, I have a pie chart written in openroad that
uses a set of radius lines  , rather than separate field segments,
	drawn in different colours, to show the chart. It uses similar
code to the below to detect where the mouse is pointing.
	 
	Robert

________________________________

	From: openroad-users-bounces at peerlessit.com
[mailto:openroad-users-bounces at peerlessit.com] On Behalf Of
rkummer at auspinners.com.au
	Sent: Wednesday, 17 October 2007 1:04 p.m.
	To: International OpenROAD Users
	Subject: Re: [Openroad-users] Clickpoint problems with
SegmentShape
	
	
	
	Hi Jim, I've had a similar problem in trying to detect where a
user clicks on a pie chart that has been generated using OpenROAD
segments. The way I got around it is by detecting the actual mouse
coordinates on a click event and then using basic trigonometry to work
out which line the mouse has clicked on. I've included the code snippet
below (apologies for the lack of comments). It requires using the
standard windows API GetWindowRect and GetCursorPos but since these are
part of user32.dll you possibly already include them as part of your
II_LIBU3GL. It has been stable and has  been in production for several
years now so it definitely works. If drawing pie graphs is the type of
thing you are doing then I can provide a more detailed example with the
actual pie generation and sample calling frame. 
	
	
	
	PROCEDURE P4_get_pie( 
	    pie= COMPOSITEFIELD,p_value = FLOAT , 
	    p_code = VARCHAR(32), 
	    p_desc = varchar(40), 
	    Li_numangles = FLOAT NOT NULL DEFAULT 500)= 
	DECLARE 
	    pscale = FLOAT NOT NULL, 
	    Li = INTEGER NOT NULL, 
	    k = INTEGER NOT NULL, 
	    theta1 = FLOAT NOT NULL, 
	    theta2 = FLOAT NOT NULL, 
	    xpos = INTEGER NOT NULL, 
	    ypos = INTEGER NOT NULL, 
	    xscale = FLOAT NOT NULL , 
	    yscale = FLOAT NOT NULL , 
	    xleft = INTEGER NOT NULL, 
	    xright = INTEGER NOT NULL, 
	    ytop = INTEGER NOT NULL, 
	    ybottom = INTEGER NOT NULL, 
	    linelen = FLOAT NOT NULL, 
	    xstart = FLOAT NOT NULL, 
	    ystart = FLOAT NOT NULL, 
	    Lf_angle = FLOAT NOT NULL, 
	    Li_angle = INTEGER NOT NULL, 
	    newlen = FLOAT NOT NULL, 
	    dexp   =DynExpr, 
	    Li_RtnStatus = INTEGER NOT NULL, 
	    pcode = VARCHAR(32) NOT NULL, 
	    pvalue = FLOAT NOT NULL, 
	    pvals = uc_pie_values 
	
	ENDDECLARE 
	BEGIN 
	    linelen = 1.1 * FLOAT8(Pie.AbsYBOTTOM - Pie.ABsYTop) /2.0;

	    Xstart = Pie.Absxright - (Pie.Absxleft + Pie.Absxright)/2.0;

	    Ystart = Pie.Absybottom - (Pie.Absytop +
Pie.AbsYBottom)/2.0; 
	    
	    xscale =
FLOAT8(CurSession.ScreenWIdth)/FLOAT8(CurSession.PixelScreenWidth); 
	    yscale =
FLOAT8(CurSession.ScreenHeight)/FLOAT8(CurSession.PixelScreenHeight); 
	    Callproc
GetWindowRect(SUBFORM(Pie).WidgetId,BYREF(xleft),BYREF(ytop),BYREF(xrigh
t),BYREF(ybottom)); 
	    CallProc GetCursorPos(BYREF(xpos),BYREF(ypos)); 
	    xpos = xscale*FLOAT8(xpos-xleft)  -  xstart; 
	    ypos = yscale*FLOAT8(ypos-ytop)  -  ystart; 
	    newlen = sqrt(FLOAT8(xpos*xpos) + FLOAT8(ypos*ypos) ); 
	    IF newlen > linelen THEN 
	        RETURN -1; 
	    ENDIF; 
	    Lf_angle =  atan(FLOAT8(ypos) / FLOAT8(xpos)) ; 
	    IF xpos >=0 AND ypos <=0 THEN 
	        lf_angle = -1*lf_angle; 
	    ELSEIF xpos <= 0 AND ypos <= 0 THEN 
	        lf_angle = 3.1415 - lf_angle ; 
	    ELSEIF xpos <= 0 AND ypos >= 0 THEN 
	        lf_angle = -1*lf_angle + 3.1415; 
	    ELSEIF xpos >= 0 AND ypos >= 0 THEN 
	        lf_angle = 6.283 - lf_angle ; 
	    ENDIF; 
	
	    lf_angle = Li_numangles * lf_angle /6.283; 
	    Li_angle =lf_angle; 
	    FOR Li = 1 to pie.Childfields.LastROw DO 
	        IF pie.childfields[Li].name = SQUEEZE('line' +
varchar(Li_angle)) THEN 
	            pvals =
uc_pie_values(pie.childfields[Li].ClientData).Duplicate(); 
	            ENDLOOP; 
	        ENDIF; 
	    ENDFOR; 
	
	    p_code =  pvals.P_code; 
	    p_desc =  pvals.P_desc; 
	    p_value = pvals.P_value; 
	
	    IF p_code = 'Other' THEN 
	        MESSAGE 'You can not drill down into the "Other"
category.'; 
	        RETURN C_RTNFAIL; 
	    ELSE 
	        RETURN C_RTNSUCCESS; 
	    ENDIF; 
	} 
	
	
	Regards, Ross Kummer 
	rkummer at auspinners.com.au 
	
	
	
	
"Antill, Jim" <jantill at revenue.ie> 
Sent by: openroad-users-bounces at peerlessit.com 

16/10/2007 08:17 PM 
Please respond to
International OpenROAD Users <openroad-users at peerlessit.com>


To
<openroad-users at peerlessit.com> 
cc
Subject
[Openroad-users] Clickpoint problems with SegmentShape	

		




	
	Hi,
	
	I'm having quite a bit of difficulty accurately detecting a
childclickpoint
	event on a segment shape within a composite and was wondering if
anyone else
	had found a solution to similar problems. I'm using OR4.0 .
	
	The problem seems to be that when a childclickpoint event is
detected the
	formfield itself doesn't pick the event up. Rather the
coordinates of the
	clickpoint are taken and the array of fields within the
composite gone
	through to find the first field that contains the clicked on
position. That
	works pretty well for rectangular shapes (as most OpenROAD
fields are).
	However, in the case of segment shapes it seems that a box is
formed from the
	start and end points and points within this are checked rather
than points
	that fall on the line itself. So if you have segments that are
close to each
	other, but not overlapping, the wrong segment is invariably
picked up. I have
	some example code here that demonstrates the problem. If anyone
is interested
	I'll post it up.
	
	More worryingly this can result in code being fired in error as
any
	clickpoint code behind the segmentshape that OpenROAD mistakenly
thinks was
	clicked is then executed.
	
	As you can imagine this leads to severe problems when doing
things such as
	Pie Charts which isn't an unusual requirement. I have tried to
use MSGraph in
	the past but had a number of issues with it's behaviour with
OpenROAD (mainly
	due to sizing). This might be improved with OR2006 I guess.
	
	So, my questions are: Does anyone know whether this behaviour
will be changed
	in OR2006, will we be given better drawing tools in the near
future e.g draw
	a filled arc in a circle etc. and has anyone a favourite
alternative to
	graphing that allows interaction between the graph and OpenROAD?
	
	Thanks for any advice.
	
	Regards,
	Jim
	
	************************
	
	This message has been delivered to the Internet by the Revenue
Internet e-mail service (OP)
	
	*************************
	
	________________________________________________________________
	OpenROAD-Users mailing list
	
	You can maintain your subscription here:
	http://www.peerlessit.com/mailman/listinfo/openroad-users
	
	To unsubscribe click on this link
	
mailto:openroad-users-unsubscribe at peerlessit.com&subject=unsubscribe
	
	To subscribe click on this link
	mailto:openroad-users-subscribe at peerlessit.com&subject=subscribe

	
	
______________________________________________________________________
	This email has been scanned by the MessageLabs Email Security
System.
	For more information please visit
http://www.messagelabs.com/email 
	
______________________________________________________________________
	
	This e-mail is privileged and confidential. If you are not the
intended recipient please delete the message and notify the sender at
Ports of Auckland Limited. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.peerlessit.com/pipermail/openroad-users/attachments/20071017/9b0c226e/attachment-0001.html 


More information about the Openroad-users mailing list