<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>

<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>You've given me two ideas:<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>1. In the Vector layer's featureadded event handler, check which
control is active.  <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>2. Apply two different feateradded event handlers to the two
different DrawFeature controls.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Either should work.  Depending on how time is left in the schedule
after I get the rest of the system working, I may revisit my derived class
solution.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Thanks.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal style='margin-left:.5in'><b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> Pierre Giraud
[mailto:pierre.giraud@camptocamp.com] <br>
<b>Sent:</b> Tuesday, April 06, 2010 9:36 AM<br>
<b>To:</b> Jeff Dege<br>
<b>Cc:</b> users@openlayers.org<br>
<b>Subject:</b> Re: [OpenLayers-Users] Different types of polygons?<o:p></o:p></span></p>

</div>

<p class=MsoNormal style='margin-left:.5in'><o:p>&nbsp;</o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:
12.0pt;margin-left:.5in'>Relying on events is often a good solution. First
because you don't have to extend or create your own classes.<br>
<br>
I think I can still be possible while listening on &quot;featureadded&quot; on
the layer and check which one of your draw feature controls is currently
activated.<br>
But perhaps it would be quicker to listen directly on each draw feature control
events. Reading the documentation [1], it seems like the DrawFeature control
also exposes a &quot;featureaded&quot; event.<br>
In the callback, it should then be easy to add an attribute like you already
did, then redraw the layer.<br>
<br>
Does it help you ?<br>
<br>
[1] <a
href="http://dev.openlayers.org/docs/files/OpenLayers/Control/DrawFeature-js.html#OpenLayers.Control.DrawFeature.EVENT_TYPES">http://dev.openlayers.org/docs/files/OpenLayers/Control/DrawFeature-js.html#OpenLayers.Control.DrawFeature.EVENT_TYPES</a><o:p></o:p></p>

<div>

<p class=MsoNormal style='margin-left:.5in'>On Tue, Apr 6, 2010 at 4:25 PM,
Jeff Dege &lt;<a href="mailto:jeff.dege@korterra.com">jeff.dege@korterra.com</a>&gt;
wrote:<o:p></o:p></p>

<div>

<div>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:.5in'><span style='font-size:11.0pt;color:#1F497D'>Once I have
features with different attributes, the mechanisms you describe would work, but
I don't have any attributes in my features to distinguish them by.</span><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:.5in'><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:.5in'><span style='font-size:11.0pt;color:#1F497D'>The features are
being created by the DrawFeature control.&nbsp; And it doesn't add any
attributes to the features it creates. My problem is how to have two different
instances of the DrawFeature control add different attributes to the features
they create.</span><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:.5in'><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:.5in'><span style='font-size:11.0pt;color:#1F497D'>Currently, I've
created my own control that adds an attribute to the feature, based on an
option passed when the control was created, and this is working. But it seems a
bit kludgy, and is likely to break if a future version of OpenLayers makes
changes to how DrawFeature.drawFeature() works.&nbsp; So I was wondering if
there was a better way to do it.</span><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:.5in'><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<div style='border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;
border-color:-moz-use-text-color -moz-use-text-color'>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:1.0in'><b><span style='font-size:10.0pt'>From:</span></b><span
style='font-size:10.0pt'> Pierre Giraud [mailto:<a
href="mailto:pierre.giraud@camptocamp.com" target="_blank">pierre.giraud@camptocamp.com</a>]
<br>
<b>Sent:</b> Tuesday, April 06, 2010 2:46 AM<br>
<b>To:</b> Jeff Dege<br>
<b>Cc:</b> <a href="mailto:users@openlayers.org" target="_blank">users@openlayers.org</a><br>
<b>Subject:</b> Re: [OpenLayers-Users] Different types of polygons?</span><o:p></o:p></p>

</div>

<div>

<div>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:1.0in'>&nbsp;<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt;
margin-left:1.0in'>You can add a listener on the &quot;featureadded&quot; event
of your vector layer. In this listener callback function, you should be able,
for example, to set a specific value for an attribute of the added feature.
Then using a StyleMap on your layer you should be able to draw the given
feature with a specific color depending on the attribute value.<br>
<br>
I hope this helps.<br>
<br>
Pierre<o:p></o:p></p>

<div>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:1.0in'>On Mon, Apr 5, 2010 at 11:26 PM, Jeff Dege &lt;<a
href="mailto:jeff.dege@korterra.com" target="_blank">jeff.dege@korterra.com</a>&gt;
wrote:<o:p></o:p></p>

<div>

<div>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:1.0in'>I find myself needing to draw two different kinds of
polygons on a Vector layer.&nbsp; First, they need to have different colors,
and second, they need to be processed differently when they are complete.<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:1.0in'>&nbsp;<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:1.0in'>I'm currently working on the first problem, and am playing
around with two DrawFeature controls.&nbsp; Right now, they behave the
same.&nbsp; I'm trying to find a way to hook into them, in some way, so I can
modify the features they create.<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:1.0in'>&nbsp;<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:1.0in'>Any ideas?<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:1.0in'>&nbsp;<o:p></o:p></p>

</div>

</div>

<p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt;
margin-left:1.0in'><br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@openlayers.org" target="_blank">Users@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><o:p></o:p></p>

</div>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:1.0in'><br>
<br clear=all>
<br>
-- <br>
Pierre GIRAUD<br>
Géomaticien, Analyste<br>
<br>
Camptocamp France SAS<br>
Savoie Technolac, BP 352<br>
73377 Le Bourget du Lac, Cedex <br>
<br>
Tel : 00 33 4 79 44 44 93<br>
Mail : <a href="mailto:pierre.giraud@camptocamp.com" target="_blank">pierre.giraud@camptocamp.com</a><br>
<a href="http://www.camptocamp.com" target="_blank">http://www.camptocamp.com</a>
&nbsp;<o:p></o:p></p>

</div>

</div>

</div>

</div>

<p class=MsoNormal style='mso-margin-top-alt:0in;margin-right:0in;margin-bottom:
12.0pt;margin-left:.5in'><br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><o:p></o:p></p>

</div>

<p class=MsoNormal style='margin-left:.5in'><br>
<br clear=all>
<br>
-- <br>
Pierre GIRAUD<br>
Géomaticien, Analyste<br>
<br>
Camptocamp France SAS<br>
Savoie Technolac, BP 352<br>
73377 Le Bourget du Lac, Cedex <br>
<br>
Tel : 00 33 4 79 44 44 93<br>
Mail : <a href="mailto:pierre.giraud@camptocamp.com">pierre.giraud@camptocamp.com</a><br>
<a href="http://www.camptocamp.com">http://www.camptocamp.com</a> &nbsp;<o:p></o:p></p>

</div>

</body>

</html>