Great! 

I dunno why we (ahem - Jon) didn't notice this way back when we first 
wrote this code.  Always easier not to check for special cases, I 
guess... 8^)

I'm betting this should be faster across the board for linear features.  
The intersection() method is very slow (for use in situations like this).

I should have a look and see what GeoServer does in this case - they 
must have the same problem, and they're usually pretty good at 
optimizing things.  But I bet they just do the same thing that you just 
implemented, Larry.

Larry Becker wrote:
>> So one thoughts is that maybe there's no point in clipping linear
>> features?  I think Swing is pretty good at rendering lines and clipping
>> them by itself.
>>
>>     
>
> Nice work Martin!  I just couldn't bear (8^) the the thought of slow
> linestring rendering, so I added (and committed) a check for linear features
> to the StyleUtil#toShape method and it worked like a charm:
>
>             if (!((geometry instanceof LineString) || (geometry instanceof
> MultiLineString)))
>                 actualGeometry = clipGeometry(geometry, bufferedEnvelope);
>
> The grizzlies are now free to roam at will. :-)  It doesn't seem to have
> slowed down display of other linear data like contours.  It might even be
> faster for those too.  To those of you who want to reproduce the problem, it
> requires a lot of self-crossing linestring segments.
>
> regards,
> Larry
>
> On Wed, Feb 24, 2010 at 11:24 AM, Martin Davis <mbda...@refractions.net>wrote:
>
>   
>> Ok, I've looked at Stefan's killer bear lines.  8^)  (Those grizz sure
>> get around...)
>>
>> I see the very slow performance in OJ.  I also tried this in the JTS
>> Test Builder app, which *doesn't* do an intersection() to clip the
>> geometries to the viewport.  The rendering is lightning fast using this
>> strategy.
>>
>> I did notice that when I ran an intersection with a box, I actually got
>> a JTS topology error!  This is yet another reason why it would be nice
>> to avoid using the full-blown intersection() method to do clipping -
>> it's doing way too much work, and isn't as stable as you'd like for a
>> display use case.
>>
>> So one thoughts is that maybe there's no point in clipping linear
>> features?  I think Swing is pretty good at rendering lines and clipping
>> them by itself.
>>
>> Alternatively, this seems like a perfect case for a "rough clipper" as
>> talked about earlier.
>>
>> BTW, would another optimization be to only clip if the geometry is much
>> larger than the viewport?  If the geometry is only slightly larger, it's
>> probably best to just let Swing do the clipping.  I think I actually
>> prototyped this one time, but I can't remember what the results were like.
>>
>> Larry Becker wrote:
>>     
>>> Hi Stefan,
>>>
>>>   Thanks.  Wow!  Pretty slow rendering indeed.
>>>
>>> Larry
>>>
>>> On Wed, Feb 24, 2010 at 10:35 AM, Stefan Steiniger <sst...@geo.uzh.ch
>>> wrote:
>>>
>>>
>>>       
>>>> Hei Larry,
>>>>
>>>> I will send them offline.
>>>>
>>>> stefan
>>>>
>>>> Larry Becker schrieb:
>>>>
>>>>         
>>>>> I'm waiting on Stefan's magic 1000 point polygon.  Mine draws too
>>>>> quickly to benchmark.
>>>>>
>>>>> On Tue, Feb 23, 2010 at 10:08 AM, Sunburned Surveyor
>>>>> <sunburned.surve...@gmail.com <mailto:sunburned.surve...@gmail.com>>
>>>>>
>>>>>           
>>>> wrote:
>>>>
>>>>         
>>>>>     Larry,
>>>>>
>>>>>     Kudos for your work on improving rendering performance in OpenJUMP.
>>>>>     Should we test the fix you mention where we "rough clip" large
>>>>>     lineStrings that contain the viewport in their bounding box?
>>>>>
>>>>>     The Sunburned Surveyor
>>>>>
>>>>>     On Mon, Feb 22, 2010 at 3:04 PM, Larry Becker
>>>>>     <becker.la...@gmail.com <mailto:becker.la...@gmail.com>> wrote:
>>>>>      > If the problem is what we have been assuming, I see where
>>>>>     Martin's algorithm
>>>>>      > could be applied:
>>>>>      >
>>>>>      >
>>>>>
>>>>>
>>>>>           
>>>> com.vividsolutions.jump.workbench.ui.renderer.style.StyleUtil#toShape()
>>>>
>>>>         
>>>>>      >
>>>>>      > We could do a conversion of large linestrings whose bounding
>>>>>     boxes contain
>>>>>      > the viewport,  to "rough clip" MultiLineStrings instead of the
>>>>>     clipGeometry
>>>>>      > call.  This should enable Java's graphics clipper to do its work
>>>>>      > efficiently.  The tough part is to not slow down the best case
>>>>>     performance
>>>>>      > too much.
>>>>>      >
>>>>>      > Larry
>>>>>      >
>>>>>      >
>>>>>      > On Mon, Feb 22, 2010 at 4:44 PM, Martin Davis
>>>>>     <mbda...@refractions.net <mailto:mbda...@refractions.net>>
>>>>>      > wrote:
>>>>>      >>
>>>>>      >> Yeah, it seems to me that I haven't seen much speed impact from
>>>>>      >> rendering fairly large linestrings.  I suppose it's possible
>>>>>     that if the
>>>>>      >> linestring was really complex the intersection() computation
>>>>>     might be
>>>>>      >> slow, however.
>>>>>      >>
>>>>>      >> In any case, computing a full intersection() is definitely
>>>>>           
>> doing
>>     
>>>>>     more
>>>>>      >> work than required for rendering.  So this would be a good
>>>>>           
>> thing
>>     
>>>> to
>>>>
>>>>         
>>>>>      >> optimize.  It's one of those things which isn't necessarily all
>>>>>
>>>>>           
>>>> that
>>>>
>>>>         
>>>>>      >> noticeable, but is quietly burning cycles all the time.
>>>>>      >>
>>>>>      >> Larry Becker wrote:
>>>>>      >> > Better send it to me too.  All the cases I've found  in the
>>>>>     wild render
>>>>>      >> > very
>>>>>      >> > quickly.  See the attached for an example.
>>>>>      >> >
>>>>>      >> > Larry
>>>>>      >> >
>>>>>      >> > On Mon, Feb 22, 2010 at 4:13 PM, Martin Davis
>>>>>      >> > <mbda...@refractions.net <mailto:mbda...@refractions.net
>>>>>
>>>>>           
>>>>>> wrote:
>>>>>>
>>>>>>             
>>>>>      >> >
>>>>>      >> >
>>>>>      >> >> Stefan, for future reference can you send the linestring,
>>>>>           
>> and
>>     
>>>> the
>>>>
>>>>         
>>>>>      >> >> viewport which causes the problem?
>>>>>      >> >>
>>>>>      >> >> Stefan Steiniger wrote:
>>>>>      >> >>
>>>>>      >> >>> mhm.. ok, so I would guess the problem is related to the
>>>>>     size of the
>>>>>      >> >>> geometries and its drawing?
>>>>>      >> >>> I recently had a problem - drawing a linestring that
>>>>>     consisted of more
>>>>>      >> >>> than 1000 points. I couldn't do anything for 20-30 seconds
>>>>>           
>> on
>>     
>>>> MS
>>>>
>>>>         
>>>>>      >> >>> Vista,
>>>>>      >> >>> my XP was a bit faster. However, the problem solved when I
>>>>>     connected
>>>>>      >> >>> the
>>>>>      >> >>> 1000 points with linestrings that have only a start and
>>>>>     endpoint, i.e.
>>>>>      >> >>> instead of drawing 1 linestring a had to draw now 500, but
>>>>>     here the
>>>>>      >> >>> 500
>>>>>      >> >>> lines could be drawn one after each other, and everything
>>>>>           
>> is
>>     
>>>>>     done
>>>>>      >> >>> within
>>>>>      >> >>> 2-3 seconds (instead of 20 secs)
>>>>>      >> >>>
>>>>>      >> >>> (if Larry wants to test, I can send that linestring?)
>>>>>      >> >>>
>>>>>      >> >>> however, I am not sure why working with the 1000 points
>>>>>     linestring is
>>>>>      >> >>> so
>>>>>      >> >>> slow (i.e. does paint make some tests?)
>>>>>      >> >>>
>>>>>      >> >>> stefan
>>>>>      >> >>>
>>>>>      >> >>> luca marletta wrote:
>>>>>      >> >>>
>>>>>      >> >>>
>>>>>      >> >>>> luca marletta
>>>>>      >> >>>> www.beopen.it <http://www.beopen.it>
>>>>>      >> >>>>
>>>>>      >> >>>>
>>>>>      >> >>>>
>>>>>      >> >>>> On Fri, Feb 19, 2010 at 5:42 PM, Larry Becker
>>>>>      >> >>>> <becker.la...@gmail.com <mailto:becker.la...@gmail.com>>
>>>>>      >> >>>>
>>>>>      >> >> wrote:
>>>>>      >> >>
>>>>>      >> >>>>> Hi luca,
>>>>>      >> >>>>>
>>>>>      >> >>>>>   When you try to select features, does the status bar
>>>>>     quickly show
>>>>>      >> >>>>>
>>>>>      >> >> your
>>>>>      >> >>
>>>>>      >> >>>>> selection count, even though no selection handles appear?
>>>>>      >> >>>>>
>>>>>      >> >>>>>   If not, this explains why the right click menu is not
>>>>>     appearing.
>>>>>      >> >>>>>  It
>>>>>      >> >>>>>
>>>>>      >> >> needs
>>>>>      >> >>
>>>>>      >> >>>>> selection information to enable or disable options.
>>>>>      >> >>>>>
>>>>>      >> >>>>>
>>>>>      >> >>>> Larry, no I had not much problem with showing selection
>>>>>     count, is
>>>>>      >> >>>> anyway
>>>>>      >> >>>>
>>>>>      >> >> quick.
>>>>>      >> >>
>>>>>      >> >>>> I noticed an important stuff.
>>>>>      >> >>>>
>>>>>      >> >>>> May dataset is full of large and aggregated geometry and
>>>>>           
>> in
>>     
>>>>>     this case
>>>>>      >> >>>> I guess geometry index can not much help.
>>>>>      >> >>>>
>>>>>      >> >>>> If I explode all, I reduce the delay a lot.
>>>>>      >> >>>>
>>>>>      >> >>>> luca
>>>>>      >> >>>>
>>>>>      >> >>>>
>>>>>      >> >>>>
>>>>>      >> >>
>>>>>      >> >>
>>>>>
>>>>>
>>>>>           
>> ------------------------------------------------------------------------------
>>     
>>>>>      >> >>
>>>>>      >> >>>> Download Intel&#174; Parallel Studio Eval
>>>>>      >> >>>> Try the new software tools for yourself. Speed compiling,
>>>>>     find bugs
>>>>>      >> >>>> proactively, and fine-tune applications for parallel
>>>>>     performance.
>>>>>      >> >>>> See why Intel Parallel Studio got high marks during beta.
>>>>>      >> >>>> http://p.sf.net/sfu/intel-sw-dev
>>>>>      >> >>>> _______________________________________________
>>>>>      >> >>>> Jump-pilot-devel mailing list
>>>>>      >> >>>> Jump-pilot-devel@lists.sourceforge.net
>>>>>     <mailto:Jump-pilot-devel@lists.sourceforge.net>
>>>>>      >> >>>>
>>>>>
>>>>>           
>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>>>
>>>>         
>>>>>      >> >>>>
>>>>>      >> >>>>
>>>>>      >> >>>
>>>>>      >> >>
>>>>>      >> >>
>>>>>
>>>>>
>>>>>           
>> ------------------------------------------------------------------------------
>>     
>>>>>      >> >>
>>>>>      >> >>> Download Intel&#174; Parallel Studio Eval
>>>>>      >> >>> Try the new software tools for yourself. Speed compiling,
>>>>>     find bugs
>>>>>      >> >>> proactively, and fine-tune applications for parallel
>>>>>     performance.
>>>>>      >> >>> See why Intel Parallel Studio got high marks during beta.
>>>>>      >> >>> http://p.sf.net/sfu/intel-sw-dev
>>>>>      >> >>> _______________________________________________
>>>>>      >> >>> Jump-pilot-devel mailing list
>>>>>      >> >>> Jump-pilot-devel@lists.sourceforge.net
>>>>>     <mailto:Jump-pilot-devel@lists.sourceforge.net>
>>>>>      >> >>>
>>>>>
>>>>>           
>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>>>
>>>>         
>>>>>      >> >>>
>>>>>      >> >>>
>>>>>      >> >>>
>>>>>      >> >> --
>>>>>      >> >> Martin Davis
>>>>>      >> >> Senior Technical Architect
>>>>>      >> >> Refractions Research, Inc.
>>>>>      >> >> (250) 383-3022
>>>>>      >> >>
>>>>>      >> >>
>>>>>      >> >>
>>>>>      >> >>
>>>>>      >> >>
>>>>>
>>>>>
>>>>>           
>> ------------------------------------------------------------------------------
>>     
>>>>>      >> >> Download Intel&#174; Parallel Studio Eval
>>>>>      >> >> Try the new software tools for yourself. Speed compiling,
>>>>>     find bugs
>>>>>      >> >> proactively, and fine-tune applications for parallel
>>>>>
>>>>>           
>>>> performance.
>>>>
>>>>         
>>>>>      >> >> See why Intel Parallel Studio got high marks during beta.
>>>>>      >> >> http://p.sf.net/sfu/intel-sw-dev
>>>>>      >> >> _______________________________________________
>>>>>      >> >> Jump-pilot-devel mailing list
>>>>>      >> >> Jump-pilot-devel@lists.sourceforge.net
>>>>>     <mailto:Jump-pilot-devel@lists.sourceforge.net>
>>>>>      >> >>
>>>>>           
>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>     
>>>>>      >> >>
>>>>>      >> >>
>>>>>      >> >
>>>>>      >> >
>>>>>      >> >
>>>>>      >> >
>>>>>      >> >
>>>>>      >> >
>>>>>
>>>>>
>>>>>           
>>>> ------------------------------------------------------------------------
>>>>
>>>>         
>>>>>      >> >
>>>>>      >> >
>>>>>
>>>>>
>>>>>           
>>>> ------------------------------------------------------------------------
>>>>
>>>>         
>>>>>      >> >
>>>>>      >> >
>>>>>      >> >
>>>>>
>>>>>
>>>>>           
>> ------------------------------------------------------------------------------
>>     
>>>>>      >> > Download Intel&#174; Parallel Studio Eval
>>>>>      >> > Try the new software tools for yourself. Speed compiling,
>>>>>           
>> find
>>     
>>>>>     bugs
>>>>>      >> > proactively, and fine-tune applications for parallel
>>>>>
>>>>>           
>>>> performance.
>>>>
>>>>         
>>>>>      >> > See why Intel Parallel Studio got high marks during beta.
>>>>>      >> > http://p.sf.net/sfu/intel-sw-dev
>>>>>      >> >
>>>>>
>>>>>
>>>>>           
>>>> ------------------------------------------------------------------------
>>>>
>>>>         
>>>>>      >> >
>>>>>      >> > _______________________________________________
>>>>>      >> > Jump-pilot-devel mailing list
>>>>>      >> > Jump-pilot-devel@lists.sourceforge.net
>>>>>     <mailto:Jump-pilot-devel@lists.sourceforge.net>
>>>>>      >> >
>>>>>           
>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>     
>>>>>      >> >
>>>>>      >>
>>>>>      >> --
>>>>>      >> Martin Davis
>>>>>      >> Senior Technical Architect
>>>>>      >> Refractions Research, Inc.
>>>>>      >> (250) 383-3022
>>>>>      >>
>>>>>      >>
>>>>>      >>
>>>>>      >>
>>>>>
>>>>>
>>>>>           
>> ------------------------------------------------------------------------------
>>     
>>>>>      >> Download Intel&#174; Parallel Studio Eval
>>>>>      >> Try the new software tools for yourself. Speed compiling, find
>>>>>
>>>>>           
>>>> bugs
>>>>
>>>>         
>>>>>      >> proactively, and fine-tune applications for parallel
>>>>>           
>> performance.
>>     
>>>>>      >> See why Intel Parallel Studio got high marks during beta.
>>>>>      >> http://p.sf.net/sfu/intel-sw-dev
>>>>>      >> _______________________________________________
>>>>>      >> Jump-pilot-devel mailing list
>>>>>      >> Jump-pilot-devel@lists.sourceforge.net
>>>>>     <mailto:Jump-pilot-devel@lists.sourceforge.net>
>>>>>      >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>>>>      >
>>>>>      >
>>>>>      >
>>>>>      > --
>>>>>      > Larry Becker
>>>>>      > Integrated Systems Analysts, Inc.
>>>>>      >
>>>>>      >
>>>>>
>>>>>
>>>>>           
>> ------------------------------------------------------------------------------
>>     
>>>>>      > Download Intel&#174; Parallel Studio Eval
>>>>>      > Try the new software tools for yourself. Speed compiling, find
>>>>>
>>>>>           
>>>> bugs
>>>>
>>>>         
>>>>>      > proactively, and fine-tune applications for parallel
>>>>>           
>> performance.
>>     
>>>>>      > See why Intel Parallel Studio got high marks during beta.
>>>>>      > http://p.sf.net/sfu/intel-sw-dev
>>>>>      > _______________________________________________
>>>>>      > Jump-pilot-devel mailing list
>>>>>      > Jump-pilot-devel@lists.sourceforge.net
>>>>>     <mailto:Jump-pilot-devel@lists.sourceforge.net>
>>>>>      > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>>>>      >
>>>>>      >
>>>>>
>>>>>
>>>>>
>>>>>           
>> ------------------------------------------------------------------------------
>>     
>>>>>     Download Intel&#174; Parallel Studio Eval
>>>>>     Try the new software tools for yourself. Speed compiling, find bugs
>>>>>     proactively, and fine-tune applications for parallel performance.
>>>>>     See why Intel Parallel Studio got high marks during beta.
>>>>>     http://p.sf.net/sfu/intel-sw-dev
>>>>>     _______________________________________________
>>>>>     Jump-pilot-devel mailing list
>>>>>     Jump-pilot-devel@lists.sourceforge.net
>>>>>     <mailto:Jump-pilot-devel@lists.sourceforge.net>
>>>>>     https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Larry Becker
>>>>> Integrated Systems Analysts, Inc.
>>>>>
>>>>>
>>>>>
>>>>>           
>> ------------------------------------------------------------------------
>>     
>>>>>
>>>>>           
>> ------------------------------------------------------------------------------
>>     
>>>>> Download Intel&#174; Parallel Studio Eval
>>>>> Try the new software tools for yourself. Speed compiling, find bugs
>>>>> proactively, and fine-tune applications for parallel performance.
>>>>> See why Intel Parallel Studio got high marks during beta.
>>>>> http://p.sf.net/sfu/intel-sw-dev
>>>>>
>>>>>
>>>>>
>>>>>           
>> ------------------------------------------------------------------------
>>     
>>>>> _______________________________________________
>>>>> Jump-pilot-devel mailing list
>>>>> Jump-pilot-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>>>>
>>>>>           
>> ------------------------------------------------------------------------------
>>     
>>>> Download Intel&#174; Parallel Studio Eval
>>>> Try the new software tools for yourself. Speed compiling, find bugs
>>>> proactively, and fine-tune applications for parallel performance.
>>>> See why Intel Parallel Studio got high marks during beta.
>>>> http://p.sf.net/sfu/intel-sw-dev
>>>> _______________________________________________
>>>> Jump-pilot-devel mailing list
>>>> Jump-pilot-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>>>
>>>>
>>>>         
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>>
>>>       
>> ------------------------------------------------------------------------------
>>     
>>> Download Intel&#174; Parallel Studio Eval
>>> Try the new software tools for yourself. Speed compiling, find bugs
>>> proactively, and fine-tune applications for parallel performance.
>>> See why Intel Parallel Studio got high marks during beta.
>>> http://p.sf.net/sfu/intel-sw-dev
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Jump-pilot-devel mailing list
>>> Jump-pilot-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>>
>>>       
>> --
>> Martin Davis
>> Senior Technical Architect
>> Refractions Research, Inc.
>> (250) 383-3022
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Download Intel&#174; Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> Jump-pilot-devel mailing list
>> Jump-pilot-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>
>>     
>
>
>
>   
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> ------------------------------------------------------------------------
>
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>   

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to