Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Microsoft .Net & .Net Compact Framework
 QCChart2D and QCChart2D CF (VB and C#)
 Knowing Zoom stack depth
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

fsjodin

26 Posts

Posted - 29 Mar 2007 :  18:54:07  Show Profile  Reply with Quote
Is there a way to know if a ChartZoom object has any zoom levels on its stack? I do not see a method or property that returns this information. And since the PushZoomStack and PopZoomStack are not virtual I can't override them to track the zoom levels.

I would like to be able to determine the current zoom stack depth since I need to have slightly different behavior if the chart is in a zoomed-in state versus it being zoomed all the way out.

Thanks

quinncurtis

1164 Posts

Posted - 30 Mar 2007 :  09:19:40  Show Profile  Reply with Quote
Thre are no special methods in the software to track the zoom stack.

You can keep track of the number of levels in the zoom stack by incrementing a counter in a subclass of the ChartZoom class, as in the example below.

	
private class ZoomWithStack: ChartZoom 
{
  int zoomstackcount = 0;

  public ZoomWithStack(ChartView component, CartesianCoordinates transform, 
        double zpos, bool brescale): base( component,  transform, zpos, brescale)
	{
	}

	public override void OnMouseDown (MouseEventArgs mouseevent)
	{
	// if right mouse buggon, pop zoom stack one level
	if ((mouseevent.Button & MouseButtons.Right) != 0)
	{
		this.PopZoomStack();
		if (zoomstackcount > 0)
			zoomstackcount--;
	}
	else
		base.OnMouseDown(mouseevent);
	}

        public override void OnMouseUp (MouseEventArgs mouseevent)
	{

		if ((mouseevent.Button & MouseButtons.Left) != 0)
		  zoomstackcount++;
		base.OnMouseUp(mouseevent);
	}
}


Or you could get the source to the QCChart2D software, which would give you access to internals of the ChartZoom class.
Go to Top of Page

fsjodin

26 Posts

Posted - 30 Mar 2007 :  17:17:46  Show Profile  Reply with Quote
Thanks, but with the suggested approach would there not be a risk of having an incorrect stack count since not all left mouse button 'mouse up' events would cause a stack push to occur? If the selection 'lasso' is less than the specified minimums it would be a mouse up event but no stack push, right?

It would be nice if the push and pop methods were virtual so it would be possible to hook into those. Was there a design decision for that or just how it ended up? If there is no particular reason for them not being virtual, could that be added in a future release?

I understand the source code can be purchased at a reasonable price but I would prefer not to create incompatibilities with future support releases unless absolutely necessary.

Go to Top of Page

quinncurtis

1164 Posts

Posted - 30 Mar 2007 :  18:39:36  Show Profile  Reply with Quote
Looking at the ChartZoom code, it looks like the push to the zoom stack takes place for any and every mouse up event, reguardless of whether the zoom range is too small to trigger an actual zoom.

The way we implemented the zoom stack has proved useful and reliable for the vast majority of zooming applications that people have written. We have not seen any demand to make the zoom stack accessible the way you describe.

In order to override virtual push and pop methods, you would need the actual source to those methods in order to see what is going on, and how to implement your own customized versions. That in turn implies that you have the source code. Making methods virtual in no way guarantees that you will be able to write your own override functions correctly, unless of course we write a custom example that demonstrates exactly how the method can be overridden.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-07 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07