<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Moiz,<br>
<br>
&nbsp; BTW, this thread would have been more suitable for the "users"
mailing list.<br>
<br>
&nbsp; Take a look at the "TransformFeature" control [1].&nbsp; It might just be
the right tool for you.<br>
<br>
Regards,<br>
<br>
Alexandre<br>
<br>
[1] <a class="moz-txt-link-freetext" href="http://www.openlayers.org/dev/examples/transform-feature.html">http://www.openlayers.org/dev/examples/transform-feature.html</a><br>
<br>
<br>
On 10-09-15 03:11 PM, Moiz Bhukhiya wrote:
<blockquote
 cite="mid:AANLkTimtqE8g+uUFCQ55muvLX6HubRo2XZiHgKybK8OW@mail.gmail.com"
 type="cite">Thank you so much Alexandre for your response. You are
absolutely right, it is working now as it should. But I have one more
question. Is there a way to resize it from all four corners, I don't
need to keep the aspect ratio. I would like to resize the box like a
cropping tool( <a moz-do-not-send="true"
 href="http://odyniec.net/projects/imgareaselect/">http://odyniec.net/projects/imgareaselect/</a>
). I am also having another problem. When I assign {displayClass:
"olControlDrawFeaturePoint"} to modifyFeature, it doesn't give strictly
horizontally aligned rectangles. I can draw rectangles in that case but
they form an angle.<br>
  <br>
I'd really appreciate any of your help.<br>
  <br>
Thanks,<br>
Moiz<br>
  <div class="gmail_quote">On Wed, Sep 15, 2010 at 7:24 AM, Alexandre
Dube <span dir="ltr">&lt;<a moz-do-not-send="true"
 href="mailto:adube@mapgears.com">adube@mapgears.com</a>&gt;</span>
wrote:<br>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
    <div bgcolor="#ffffff" text="#000000">
Hi Moiz,<br>
    <br>
&nbsp; The constructor of the control only takes 2 parameters [1] and you
give it 3.&nbsp; This might be why it doesn't work.<br>
    <br>
Regards,<br>
    <br>
Alexandre<br>
    <br>
    <br>
[1]
    <a moz-do-not-send="true"
 href="http://dev.openlayers.org/releases/OpenLayers-2.10/doc/apidocs/files/OpenLayers/Control/ModifyFeature-js.html#OpenLayers.Control.ModifyFeature.OpenLayers.Control.ModifyFeature"
 target="_blank">http://dev.openlayers.org/releases/OpenLayers-2.10/doc/apidocs/files/OpenLayers/Control/ModifyFeature-js.html#OpenLayers.Control.ModifyFeature.OpenLayers.Control.ModifyFeature</a>
    <div>
    <div class="h5"><br>
    <br>
On 10-09-15 05:32 AM, Moiz Bhukhiya wrote:
    </div>
    </div>
    <blockquote type="cite">
      <div>
      <div class="h5">Hi,<br>
      <br>
I am using vector (polygon) layer with draw feature and modify feature.
Let me explain first what I am trying to achieve. I want to draw
rectangles(strict horizontally aligned) and after drawing it might
require a little bit of modification but again it shouldn't lose its
shape. <br>
      <br>
Here is what I tried doing:<br>
      <br>
polygonLayer = new OpenLayers.Layer.Vector("Capture Region",
{displayInLayerSwitcher: true, reproject: true});<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; polyOptions = {sides: 4, snapAngle: 180, irregular: true}; //To
draw only rectangles<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var pan = new OpenLayers.Control.Navigation({title: "Navigate"})<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; polygonControl = new
OpenLayers.Control.DrawFeature(polygonLayer,
OpenLayers.Handler.RegularPolygon, <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {handlerOptions: polyOptions});<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; modify = new OpenLayers.Control.ModifyFeature(<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; polygonLayer, {displayClass: "olControlModifyFeature",
title: "Modify Features"}, <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {mode: ~OpenLayers.Control.ModifyFeature.RESHAPE |
OpenLayers.Control.ModifyFeature.RESIZE <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | OpenLayers.Control.ModifyFeature.DRAG }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var panel = new OpenLayers.Control.Panel({<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; displayClass: "olControlEditingToolbar"<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; panel.addControls([pan, polygonControl, modify]);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.addControl(panel);<br>
      <br>
The problem is it doesn't follow the modify feature modes I have
defined. It allows reshaping and doesn't allow dragging and resizing.
Another problem I have is when I define the displayClass for draw
feature, it wouldn't let me draw rectangles that are horizontally
aligned. To point your attention towards where I might be making a
mistake, I am using OpenLayers.Handler.RegularPolygon to draw feature.
Is that a problem?<br>
      <br>
Thanks a lot for taking time to read my problem and I'd really
appreciate if you could help me with any suggestions and ideas.<br>
      <br>
Thanks!<br>
Moiz<br>
      </div>
      </div>
      <pre><fieldset></fieldset>
_______________________________________________
Dev mailing list
<a moz-do-not-send="true" href="mailto:Dev@lists.osgeo.org"
 target="_blank">Dev@lists.osgeo.org</a>
<a moz-do-not-send="true"
 href="http://lists.osgeo.org/mailman/listinfo/openlayers-dev"
 target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-dev</a>
  </pre>
    </blockquote>
    <br>
    <br>
    <pre cols="72">-- 
Alexandre Dub&eacute;
Mapgears
<a moz-do-not-send="true" href="http://www.mapgears.com" target="_blank">www.mapgears.com</a>
    </pre>
    </div>
    <br>
_______________________________________________<br>
Dev mailing list<br>
    <a moz-do-not-send="true" href="mailto:Dev@lists.osgeo.org">Dev@lists.osgeo.org</a><br>
    <a moz-do-not-send="true"
 href="http://lists.osgeo.org/mailman/listinfo/openlayers-dev"
 target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-dev</a><br>
    <br>
  </blockquote>
  </div>
  <br>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
Alexandre Dub&eacute;
Mapgears
<a class="moz-txt-link-abbreviated" href="http://www.mapgears.com">www.mapgears.com</a>
</pre>
</body>
</html>