Print

Print


Continuous2D is clipping objects whose origin is outside of the space (plus a bit of slop).  This is important: consider if you had ten million points and were zoomed in to only view 10 of them.  Without the clip, you're going to be stuck making ten million graphics calls to draw ten objects.  Not good.

This is also an issue, by the way for NetworkPortrayal2D: if either of the end-points of a line are out of region, NetworkPortrayal2D doesn't try drawing the line even if it would be visible on-screen.

So what to do?  Well, the crucial line is this:

                if (loc.x >= startx - discretizationOverlap && loc.x < endx + discretizationOverlap &&
                    loc.y >= starty - discretizationOverlap && loc.y < endy + discretizationOverlap)

"discretizationOverlap" is the slop. And it's equal to the field discretization.  An easy solution is to make the discretization very large, and Continuous2D will assume it has to draw everything within the discretization region.  Another approach is to just go in and change the above line to:

		if (true)

Sean 

On Jul 16, 2013, at 3:35 PM, Joseph F Harrison wrote:

> I have a class called TravelDisruption which has, among other things, coordinates for start and end points. I'm placing these objects in a Continuous2D field using the start point as the location and I've written a TravelDisruptionPortrayal2D which draws it. The problem is that it doesn't get drawn unless the start point is on the screen. How do I fix this so it draws when any of it is on-screen?
> 
> Joey