[OpenLayers-Dev] Draw boxes on the image pressing shift key

Tim Schaub tschaub at opengeo.org
Wed Aug 4 15:49:29 EDT 2010


On 8/4/10 12:31 PM, Moiz Bhukhiya wrote:
> Hello Devs,
>
> I am using Openlayers to display images from Djatoka Image server. I am
> using two different layers.
> 1. To draw boxes on an image which is OpenLayers.Layer.Boxes
> 2. To dynamically draw boxes on images I am using OpenLayers.Control()
>
> Using Control() functionality I can draw boxes on the image pressing
> shift key and on mouse down, and on mouse up I can get the coordinates
> of the box on the image. On mouse up the box disappears and I get the
> coordinates. My problem is I do not want this box to disappear until I
> invoke it. I want to draw the box and resize it if required (like we do
> in Jquery crop plugin Eg:http://odyniec.net/projects/imgareaselect )
>
> It would be of great help if you could guide me how do I achieve this
> functionality.
>

Alternatively, you could use a Vector layer and a DrawFeature control 
with a RegularPolygon handler.

See http://openlayers.org/dev/examples/regular-polygons.html

Sounds like an irregular polygon with four sides (rectangle) snapped to 
90 would give you want you want.

Tim

> Thanks,
> Moiz
>
>
>
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev


-- 
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.



More information about the Dev mailing list