$thumbsmaxsize = 400; // default value;
}
-if (defined ("POPUPNEARFEATURE") && (POPUPNEARFEATURE)) {
- $popupnearfeature = true;
+if (defined ("POPUPPOS")) {
+ $popuppos = POPUPPOS;
} else {
- $popupnearfeature = false;
+ $popuppos = 3;
}
?>
<html lang="<?php echo $lang?>">
noImageRegistered: "<?php ptrans('There is no image registered on this site.')?>"
};
var sypSettings = {
- popupNearfeature: <?php printf ($popupnearfeature ? "true": "false")?>
+ popupPos: <?php printf ($popuppos)?>
};
</script>
<script src="./openlayers/OpenLayers.js" type="text/javascript"></script>
// uploaded image is bigger, images will be resized.
define ("THUMBSMAXSIZE", 400);
-// if set to 0 (default), popup will appear at bottom right corner of the map.
-// If set to 1 or true, popup will appear near marker.
-define ("POPUPNEARFEATURE", 0);
+// If set to 0 popup will appear near selected marker.
+// If set to 1, popup will appear at top left corner of the map
+// If set to 2, popup will appear at top right corner of the map
+// If set to 3 (default), popup will appear at bottom right corner of the map
+// If set to 4, popup will appear at bottom left corner of the map
+define ("POPUPPOS", 3);
?>
var popup = feature.popup;
var popupPos = null;
- if (sypSettings.popupNearfeature) {
- popupPos = feature.geometry.getBounds().getCenterLonLat();
- } else {
- popupPos = SYP.Utils.brCorner(map, 8);
+ switch (sypSettings.popupPos) {
+ case 0:
+ popupPos = feature.geometry.getBounds().getCenterLonLat();
+ break;
+ case 1:
+ popupPos = SYP.Utils.tlCorner(map, 8);
+ break;
+ case 2:
+ popupPos = SYP.Utils.trCorner(map, 8);
+ break;
+ case 3:
+ popupPos = SYP.Utils.brCorner(map, 8);
+ break;
+ case 4:
+ popupPos = SYP.Utils.blCorner(map, 8);
+ break;
+ default:
+ popupPos = SYP.Utils.brCorner(map, 8);
+ break;
}
// we cannot reuse popup; we need to recreate it in order for IE
},
Utils: {
+ tlCorner: function(map, margin) {
+ var bounds = map.calculateBounds();
+ var corner = new OpenLayers.LonLat(bounds.left, bounds.top);
+ var cornerAsPx = map.getPixelFromLonLat(corner);
+ cornerAsPx = cornerAsPx.add( +margin, +margin);
+ return map.getLonLatFromPixel(cornerAsPx);
+ },
+
+ trCorner: function(map, margin) {
+ var bounds = map.calculateBounds();
+ var corner = new OpenLayers.LonLat(bounds.right, bounds.top);
+ var cornerAsPx = map.getPixelFromLonLat(corner);
+ cornerAsPx = cornerAsPx.add( -margin, +margin);
+ return map.getLonLatFromPixel(cornerAsPx);
+ },
+
brCorner: function(map, margin) {
var bounds = map.calculateBounds();
var corner = new OpenLayers.LonLat(bounds.right, bounds.bottom);
var cornerAsPx = map.getPixelFromLonLat(corner);
cornerAsPx = cornerAsPx.add( -margin, -margin);
- corner = map.getLonLatFromPixel(cornerAsPx);
- return corner;
+ return map.getLonLatFromPixel(cornerAsPx);
+ },
+
+ blCorner: function(map, margin) {
+ var bounds = map.calculateBounds();
+ var corner = new OpenLayers.LonLat(bounds.left, bounds.bottom);
+ var cornerAsPx = map.getPixelFromLonLat(corner);
+ cornerAsPx = cornerAsPx.add( +margin, -margin);
+ return map.getLonLatFromPixel(cornerAsPx);
},
/* minimum bounds rectangle containing all feature locations.