<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi Christian,<br>
      <br>
        I would seem that even thought you send the feature itself as
      context, it will ends up using the feature.attributes hash
      anyway.  You can see for yourself by loading an uncompressed
      version of OpenLayers, put a breakpoint inside your context method
      until you get to that line :<br>
      <br>
          OpenLayers/Filter/Comparison.js :<br>
      <br>
          evaluate: function(context) {<br>
              if (context instanceof OpenLayers.Feature.Vector) {<br>
                  context = context.attributes;<br>
              }<br>
          ...<br>
      <br>
        So, because 'fid' is not one of the attributes, the evaluation
      fails and no style is applied.<br>
      <br>
        In order to evaluate on the feature fid, you can use the
      OpenLayers.Filter.FeatureId instead and create your own rules.  If
      you're not familiar with filters, you can take a look at this
      example: <br>
          <a class="moz-txt-link-freetext" href="http://openlayers.org/dev/examples/filter.html">http://openlayers.org/dev/examples/filter.html</a><br>
      <br>
        Once you get that filter working, you'll see your point turn
      green when selected.<br>
      <br>
        Lastly, when you use rules, you need to cover all possibilities
      for all features to render.  If you only specify one rule with
      "property equal something", all features that evaluates the rule
      correctly will render, but not the others.  A quick way to make
      sure the other at least render, you can specify an elseFilter :<br>
      <br>
          styleMap.styles["select"].addRules([new OpenLayers.Rule({<br>
              symbolizer: {strokeColor:"black",strokeWidth: 10},<br>
              elseFilter: true<br>
          })]);<br>
      <br>
        Try that and see how it goes.<br>
      <br>
      HTH,<br>
      <br>
      Alexandre<br>
      <br>
      <br>
      On 12-08-09 12:46 PM, Christian Benke wrote:<br>
    </div>
    <blockquote
cite="mid:CAAMQ8bScKhyQ2Qh6xGZyVyYOVuqg1ffumm6yMkhwmFw444X8Ug@mail.gmail.com"
      type="cite">Hello!<br>
      <br>
      <div>I'm having difficulties to understand how addUniqueValueRules
        is applied.</div>
      <div><br>
      </div>
      <div><a moz-do-not-send="true"
          href="http://poab.org/openlayers/stylerule.html">http://poab.org/openlayers/stylerule.html</a> fetches
        data from a GeoJSON-file and draws a point and a line according
        to the styling in styleMap.</div>
      <div><br>
      </div>
      <div>My goal is to have the Point and the Line drawn in different
        colors. To achieve this goal i try to add a "Unique Value Rule"
        with the property set to "fid" and a symbolizer matching the
        value "999", which should draw the strokeColor of the point as
        green when selected.</div>
      <div><br>
      </div>
      <div>However, the Point simply disappears when selected.</div>
      <div><br>
      </div>
      <div>I've been banging my head against this problem for hours, i
        just don't see why the rule doesn't seem to match any attribute
        i try to feed it, while the attribute exists in the
        vector-object i'm matching it against. </div>
      <div>I also don't understand why the feature i'm selecting
        actually disappears - if the rule does not match, the selected
        feature should actually not be changed?!</div>
      <div><br>
      </div>
      <div>How can i debug the addUniqueValueRules-function?</div>
      <div><br>
      </div>
      <div>I'm not asking to solve the issue for me, but if anyone could
        take a look at my example and help me understand where i'm
        misunderstanding the concept, it would help me sleep better
        tonight :-)</div>
      <div><br>
      </div>
      <div>Best regards,</div>
      <div>Christian</div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/openlayers-users">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Alexandre Dubé
Mapgears
<a class="moz-txt-link-abbreviated" href="http://www.mapgears.com">www.mapgears.com</a>
</pre>
  </body>
</html>