Region Editor


Drawing a Polygon

Modifying a Polygon

Buttons

Using an Edition Frame

Predefined Polygons:

Predefined Edition Frames:


The following links must be prepended to the HTML page hosting the tool.
There no minified version right now.
The JS code is based on JQuery.
			<link rel="stylesheet" href="http://aladin.u-strasbg.fr/AladinLite/api/v2/latest/aladin.min.css" />

<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js" charset="utf-8"></script>
<script type="text/javascript" src="http://aladin.u-strasbg.fr/AladinLite/api/v2/latest/aladin.js" charset="utf-8"></script>
<script type="text/javascript" src="saadajsbasics/javascript/Segment.js" charset="utf-8"></script>
<script type="text/javascript" src="saadajsbasics/javascript/AstroCoo.js" charset="utf-8"></script>
<script type="text/javascript" src="saadajsbasics/javascript/RegionEditor_m.js" charset="utf-8"></script>
<script type="text/javascript" src="saadajsbasics/javascript/RegionEditor_v.js" charset="utf-8"></script>
<script type="text/javascript" src="saadajsbasics/javascript/RegionEditor_c.js" charset="utf-8"></script>
The region editor must be initialized in the $.ready() JQuery handler.
			$.ready = function() {
    regionEditor = new RegionEditor_mVc("aladin-lite-div"
            , function(data) {
               if (data.userAction)
		          alert(JSON.stringify(data));
               });
    regionEditor.init();
	}
The JSON below show the way polygons are described.
Sometime, the user handler can be called automatically. These possibly spurious events can be filtered by the userAction flag. The size given here is just a indication; the real size is computed by the tool each time it needs it.
			{ "isReady":true,
  "userAction":true,
  "region":{
       "format":"array2dim",
       "points":[[12.88371,-11.182474],[345.964137,-9.737165],[352.89423,10.130681],[12.883716,-11.182474]],
       "size":{"x":19.989480,"y":21.313155}}
   }
A polygon can be drawn by the API:
			regionEditor.setInitialValue(points);
where points has the following form:
			{
type : "array",
value : [ 0, 89, 120, 89, 240, 89 ]
}
Edition frames can also be drawn by the API:
			regionEditor.setEditionFrame(points);
where points can either have the previous form or the following one:
			{
type : "soda",
value : "POLYGON 0 89 120, 89 240 89"
}

Copyright (c) 2017 Laurent Michel
laurent.michel at astro.unistra.fr - Observatoire Astronomique de Strasbourg (FR)