I think I may have found a partial answer to some of my questions to
Larry and Jon above.

It appears that the getRenderer() method of the RenderingManager
returns the same Renderer for all Layers. (Well, all Layers that
aren't WMS Layers.) It is incorrect to say the same Renderer. I should
say it returns instances of the same Renderer class for all layers.

I was thinking that you assigned the type of renderer to each Layer
either during or shortly after it was created, but this is not at all
the case.

I see now that Layers contain their own Styles. These Styles contain
information about color, stroke width, etc...that make the appearance
of each layer unique.

Now I just need to figure out when this method is called as a result
of the LayerViewPanel.paintComponent() method. I think Eclipse can
help me out with this, if I can remember how to get it to do what I
want. At any rate I'm getting closer to understanding what is going on
here.

I did discover one interesting thing while I was looking at this
method. I had always thought that OpenJUMP supported "pluggable"
renderers. In other words, I thought we could assign a "custom"
renderer to specified Layers at runtime. I'm looking at the source
code for JUMP 1.1 right now and it doesn't appear this is the case in
this version. It looks like that change would have to be hard coded
into this method.

I think Ole had talked about changing this in OpenJUMP as part of his
work on raster/image support.

Is that correct?

The Sunburned Surveyor

On 11/30/06, Sunburned Surveyor <[EMAIL PROTECTED]> wrote:
> Thanks for your help Larry. Let me see if I understand what is going
> on in this method.
>
> for (Iterator i = styles.iterator(); i.hasNext();) {
> Style style = (Style) i.next();
>
> Get each Style  object stored in the collection of Styles in the
> SimpleFeatureCollectionRenderer.
>
> for (Iterator j = layerToFeaturesMap.keySet().iterator(); j.hasNext();) {
>   Layer layer = (Layer) j.next();
>
> The SimpleFeatureCollectionRenderer stores a HashMap that associates
> Layer objects with FeatureCollections. (These FeatureCollections
> contain the Features in the Layer visible in the current envelope of
> the Viewport???)
>
> Collection features = (Collection) layerToFeaturesMap.get(layer);
>   paint(g, features, layer, style);
>
> Get the Features associated with the Layer in the HashMap. Then pass
> these Feature objects, the Layer, and the Style to the other Paint()
> method in the SimpleFeatureCollectionRenderer class.
>
> Is that correct?
>
> If so, which class creates the layerToFeaturesMap? Does this mean a
> SimpleFeatureCollectionRenderer can be associated with more than one
> Layer?
>
> (That appears to be the case.)
>
> The Sunburned Surveyor
>
>
> On 11/30/06, Larry Becker <[EMAIL PROTECTED]> wrote:
> > Sunburned,
> >
> >    I'll let Jon answer, but the code you posted is not what he was referring
> > to.  Instead look into (for example) SimpleFeatureCollectionRenderer for:
> >
> >     protected void paint(Graphics2D g) throws Exception {
> >         for (Iterator i = styles.iterator(); i.hasNext();) {
> >             Style style = (Style) i.next();
> >             if (cancelled) {
> >                 return;
> >             }
> >             for (Iterator j = layerToFeaturesMap.keySet().iterator(); j
> >                     .hasNext();) {
> >                 Layer layer = (Layer) j.next();
> >                 if (cancelled) {
> >                     return;
> >                 }
> >                 Collection features = (Collection) layerToFeaturesMap
> >                         .get(layer);
> >                 paint(g, features, layer, style);
> >             }
> >         }
> >     }
> >
> > Note the nested for loops with style on the outer and features on the
> > inside.
> >
> > regards,
> > Larry
> >
> >
> > On 11/30/06, Sunburned Surveyor <[EMAIL PROTECTED]> wrote:
> > >
> > > Thanks for replying Jon. It looks like Larry was already able to get
> > > to the bottom of the problem we were discussing. I'm still curious
> > > about something though. Maybe you will have a few minutes to help me
> > > out.
> > >
> > > You wrote: "If memory serves, LayerViewPanel's RenderingManager loops
> > > through the LayerManager's layers. For each layer it loops through the
> > > layer's Styles and calls paint() on each one."
> > >
> > > Yes. I think that is this code:
> > >
> > > public void copyTo(Graphics2D destination) {
> > >     for (Iterator i = contentIDs().iterator(); i.hasNext();) {
> > >       Object contentID = i.next();
> > >
> > >          if (getRenderer(contentID) != null) {
> > >
> > getRenderer(contentID).copyTo(destination);
> > >          }
> > >     }
> > > }
> > >
> > > Here is my question though. When and how does OJ assign a Layer a
> > > Renderer. Is this done when a layer is created, or after?
> > >
> > > SS
> > >
> > >
> > > On 11/29/06, Jonathan Aquino <[EMAIL PROTECTED]> wrote:
> > > > Hi Sunburned - If memory serves, LayerViewPanel's RenderingManager loops
> > > > through the LayerManager's layers. For each layer it loops through the
> > > > layer's Styles and calls paint() on each one.
> > > >
> > > > Jon
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: [EMAIL PROTECTED]
> > > > >
> > [mailto:[EMAIL PROTECTED] ] On
> > > > > Behalf Of Sunburned Surveyor
> > > > > Sent: Wednesday, November 29, 2006 10:29 PM
> > > > > To: List for discussion of JPP development and use.
> > > > > Subject: [JPP-Devel] OJ's rendering code...
> > > > >
> > > > >
> > > > > I feel like I'm in a maze with no exit... :]
> > > > >
> > > > > I've been going through OJ's rendering code for an hour or
> > > > > two. I was hoping to find out some more about our double call
> > > > > to BasicStyle.paint().
> > > > >
> > > > > I don't think I'm going to get as near as far as I had hoped,
> > > > > although I am throwing together some notes about the
> > > > > rendering system I'll try to get on the wiki.
> > > > >
> > > > > There is one thing I haven't been able to figure out. At what
> > > > > point, and how, does OpenJUMP associate a Renderer with a
> > > > > Layer? I've looked at the the RenderingMananger class, the
> > > > > LayerManager class, the LayerViewPanel class, the
> > > > > FeatureCollectionRenderer class, and a bunch of other
> > > > > classes, but I can't determine where this takes place.
> > > > >
> > > > > At some point after a Layer is created, but before or at the
> > > > > moment it is made visible, OJ needs to decide which Renderer
> > > > > will paint the Layer's contents on the LayerViewPanel.
> > > > >
> > > > > Where is this done?
> > > > >
> > > > > Does each Renderer track what Layers it needs to paint, or is
> > > > > this done by the RendererMananger?
> > > > >
> > > > > Thanks for the help.
> > > > >
> > > > > The Sunburned Surveyor
> > > > >
> > > > >
> > --------------------------------------------------------------
> > > > > -----------
> > > > > Take Surveys. Earn Cash. Influence the Future of IT
> > > > > Join SourceForge.net's Techsay panel and you'll get the
> > > > > chance to share your opinions on IT & business topics through
> > > > > brief surveys - and earn cash
> > > > >
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge
> > > > &CID=DEVDEV
> > > > _______________________________________________
> > > > Jump-pilot-devel mailing list
> > Jump-pilot-devel@lists.sourceforge.net
> > > >
> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> > > >
> > > >
> > > >
> > -------------------------------------------------------------------------
> > > > Take Surveys. Earn Cash. Influence the Future of IT
> > > > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > your
> > > > opinions on IT & business topics through brief surveys - and earn cash
> > > >
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > > _______________________________________________
> > > > Jump-pilot-devel mailing list
> > > > Jump-pilot-devel@lists.sourceforge.net
> > > >
> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> > > >
> > >
> > >
> > -------------------------------------------------------------------------
> > > Take Surveys. Earn Cash. Influence the Future of IT
> > > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > your
> > > opinions on IT & business topics through brief surveys - and earn cash
> > >
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > _______________________________________________
> > > Jump-pilot-devel mailing list
> > > Jump-pilot-devel@lists.sourceforge.net
> > >
> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> > >
> >
> >
> > -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share your
> > opinions on IT & business topics through brief surveys - and earn cash
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >
> > _______________________________________________
> > Jump-pilot-devel mailing list
> > Jump-pilot-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >
> >
> >
>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to