Re: [OpenMap Users] Moving the map like Google

From: Rob Ratcliff <rrr6399_at_futuretek.com>
Date: Thu, 10 Apr 2008 08:31:25 -0600

BTW, it looks like that file got moved somewhere else, but here is the
original from the Attic:
http://www.netbeans.org/source/browse/profiler/libs/jfluid-ui/src/org/netbeans/lib/profiler/ui/charts/Attic/SynchronousXYChart.java?rev=1.2&view=auto&content-type=text/vnd.viewcvs-markup

F.Bayliss wrote:
> Thanks Rob.
>
> I've tried variations of #1 and #2 and the delay in creating the image
> isn't acceptable by management. Except for the delay it worked well.
> I've thought about #3 but wasn't sure of the best approach. If they
> still insist on having me work on this I'll look into this idea.
>
> Thanks
> Frank
>
>
> Rob Ratcliff wrote:
>> I think Google maps just loads image tiles around the current
>> projection so when you translate, the images are already there and
>> makes it look smooth.
>>
>> Here are few ideas you might try:
>>
>> 1.) cache the image buffer between panel resizes and reuse it
>>
>> 2.) create a layer or mousemode that takes a image snapshot of the
>> current map and then translate the image to the new locations during
>> the mouse drag and the notify the layers to update after the mouse
>> button is released or modify each layer to draw a cached offscreen
>> image during mouse movements and recalculate upon mouse up.
>>
>> 3.) If you don't like the the idea of translating an image with the
>> resulting unrendered gaps that show up, you could keep track of dirty
>> areas and the only recalulate those regions. NetBeans chart code had
>> some high performance ways of translating the chart in time and only
>> updating the new deltas which may be useful (with some surgery):
>> http://www.netbeans.org/source/browse/profiler/libs/jfluid-ui/src/org/netbeans/lib/profiler/ui/charts/SynchronousXYChart.java?rev=1.1&view=auto&content-type=text/vnd.viewcvs-markup
>>
>> // draws scaled chart from provided viewOffsetX
>> private void drawChartFromOffset(Graphics2D g2, long offsetX) {
>>
>> ...
>>
>> if ((copyWidth > 0) && (dirtyWidth > 0) && (chartHeight > 0)) {
>> // copy not-changed-areas to the left
>> if (copyAccel == COPY_ACCEL_RASTER) {
>> // BufferedImage.getRaster().setDataElements() used, seems to have better performance on Windows (HW acceleration)
>> int rasterWidth = offScreenImage.getRaster().getWidth();
>> int rasterHeight = offScreenImage.getRaster().getHeight();
>> int startX = chartInsets.left + dirtyWidth;
>> int startY = chartInsets.top;
>>
>> if ((startX >= 0) && ((startX + copyWidth) <= rasterWidth) && (startY >= 0)
>> && ((startY + chartHeight) <= rasterHeight) && (chartInsets.left >= 0)
>> && ((chartInsets.left + copyWidth) <= rasterWidth) && (chartInsets.top >= 0)
>> && ((chartInsets.top + chartHeight) <= rasterHeight)) {
>> Raster raster = offScreenImage.getRaster()
>> .createWritableChild(startX, startY, copyWidth, chartHeight, 0,
>> 0, null);
>> offScreenImage.getRaster().setDataElements(chartInsets.left, chartInsets.top, raster);
>> }
>> } else {
>> // Graphics.copyArea() used, optimal for UNIXes, works well also for Windows (default)
>> g2.copyArea(chartInsets.left + dirtyWidth, chartInsets.top, copyWidth, chartHeight, -dirtyWidth, 0);
>> }
>> }
>>
>>
>>
>>
>>
>>
>> F.Bayliss wrote:
>>> Hello,
>>>
>>> I've been asked by my upper management to once again mimic the way
>>> Google allows the user to move the map. I've spent a lot of time on
>>> this, too much, and I don't see anyway it can work. I have several,
>>> several layers and the time it takes to process and draw a map
>>> movement event is slow and that results in a choppy map picture.
>>> I've tried several approaches, the best being drawing the map to an
>>> image buffer and replacing the map with that, letting them move what
>>> they think is the map. But this isn't acceptable because it takes
>>> time to create the image. I was hoping the experts had a better idea.
>>>
>>> Thanks
>>> Frank
>>>
>>> --
>>> [To unsubscribe to this list send an email to "majdart_at_bbn.com"
>>> with the following text in the BODY of the message "unsubscribe
>>> openmap-users"]
>>>
>>
>>
>> --
>> Rob Ratcliff
>> cell: 512-633-5751
>> office: 512-250-3444
>> fax: 512-233-2873
>> web: http://www.futuretek.com


-- 
Rob Ratcliff
FutureTek Net Services
cell: 512-633-5751
office: 512-250-3444
fax: 512-233-2873
web: http://www.futuretek.com
--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Apr 10 2008 - 09:31:34 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:09 EDT