Hi,

On 7/9/07, Al Byers <[EMAIL PROTECTED]> wrote:
>
>
> On 7/9/07, Andreas Hocevar <[EMAIL PROTECTED]> wrote:

> > The only thing that is not ready yet is to render every feature with a
> > unique image. This is planned to do with a SLD based fidFilter, but I
> > had no time to implement it. If you are willing to help out here, I
> > can give you more details on how it could be done. It should not be
> > too much work, and it is all in Mapbuilder - no need to change SVG/VML
> > renderers in OpenLayers.
>
>  I have a need for this, so I would be glad to take a stab at it if you wish
> to send me some info.

Ok, here is some info:

First of all, the point where you can insert your custom styling is in
GmlRendererOL, in the preFeatureInsert method of the OlLayer object.
Currently, this method applies default styles for each feature. Those
are taken from the widgets's SLD model in the paint method (look for
objRef.defaultStyle and objRef.selectStyle).

If you have a style definition based on the feature id (fid) of your
feature, you can also apply it in the preFeatureInsert method. There
are certainly many ways to do it, but the preferred way in Mapbuilder
is to use open standards. And this, again, would be via SLD (Styled
Layer Descriptor).

Some good examples for SLD can be found at
http://docs.codehaus.org/display/GEOSDOC/SLD+Snippets

Filters can be applied to SLD, which could look like
<FeatureTypeStyle>
  <Rule>
    <Filter xmlns="http://www.opengis.net/ogc";>
      <FeatureId fid="states.3"/>
    </Filter>
    <PointSymbolizer>
      <Graphic>
        <ExternalGraphic>
          <OnlineResource xlink:href="images/frog.gif"/>
          <Format>image/gif</Format>
        </ExternalGraphic>
        <Size>10</Size>
      </Graphic>
    </PointSymbolizer>
  </Rule>
</FeatureTypeStyle>

OGC filters are even more powerful, you can eg. filter by neat queries
like PropertyIsGreaterThan.

If you get your image sources dynamically from somewhere, you could
write a tool that adds FeatureTypeStyles with FeatureId filters to the
sld model.

You would then maybe add some query methods to
StyledLayerDescriptor.js, so you do not need to create XPath queries
for getting styles from the SLD model (like currently in the paint
method of GmlRendererOL). Those queries go into the preFeatureInsert
method then, where you get the appropriate style for your feature
based on its fid. Remember that you can save the style to the feature
(feature.style), so you do not need to query the sld model every time
the feature is drawn.

I hope this helps. If you have more questions, do not hesitate to contact me.

Regards,
Andreas.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
mapbuilder-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mapbuilder-devel

Reply via email to