Re: [mapguide-users] How to get selection with fusion??

2014-03-05 Thread Kajar
I use MGOS 2.6, there is such widget as map.js only Maptip.js. Is this same
as map widget.
But where this selection info are displayed?



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/How-to-get-selection-with-fusion-tp4187847p5107612.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users


Re: [mapguide-users] How to get selection with fusion??

2014-03-05 Thread GordonL
If you are using the Template (i.e. Aqua) I would just put the code in the
index.html and not worry about a widget for now...





--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/How-to-get-selection-with-fusion-tp4187847p5107726.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users


Re: [mapguide-users] How to get selection with fusion??

2014-03-05 Thread Kajar
Ok I put the code to Aqua index.html also with openlayers popup code like
this, but cant get popup working when select feature on map. What I'm doing
wrong, I'm not skilled programmer, just beginner.

script type=text/javascript
//selection//
var themap;
var fusionInitialized = function() {
$('AppContainer').resize({forceResize: true});
   
 themap = Fusion.getWidgetById('Map');
 themap.registerForEvent(Fusion.Event.MAP_SELECTION_ON,
selectionOn);
}
var selectionOn = function()
{
 var maps = themap.getAllMaps();
 var map = maps[0];
 map.getSelection(displaySelection);
}
function displaySelection(res){
  var layer = res.getLayer(0);
 var propNames = layer.getPropertyNames();
 var msg;
 for (var j=0; jlayer.getNumElements(); j++) {
 for (var k=0; klt;propNames.length; k++)
  msg += (quot;\nquot; + propNames[k] +quot;  quot;+
layer.getElementValue(j, k));
  }
  alert(msg);
} 
//openlayers popup start//
var map, drawControls, selectControl, selectedFeature;
function onPopupClose(evt) {
selectControl.unselect(selectedFeature);
}
function onFeatureSelect(feature) {
selectedFeature = feature;
popup = new OpenLayers.Popup.FramedCloud(quot;chickenquot;, 

feature.geometry.getBounds().getCenterLonLat(),
 null,
 quot;lt;div
style='font-size:.8em'Feature:  + feature.id +brArea:  +
feature.geometry.getArea()+/div,
 null, true, onPopupClose);
feature.popup = popup;
map.addPopup(popup);
}
function onFeatureUnselect(feature) {
map.removePopup(feature.popup);
feature.popup.destroy();
feature.popup = null;
}
function init(){
map = new OpenLayers.Map('map');
var wmsLayer = new OpenLayers.Layer.WMS( OpenLayers WMS, 
http://vmap0.tiles.osgeo.org/wms/vmap0?;, {layers:
'basic'}); 

var polygonLayer = new OpenLayers.Layer.Vector(Polygon Layer);

map.addLayers([wmsLayer, polygonLayer]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.MousePosition());

selectControl = new
OpenLayers.Control.SelectFeature(polygonLayer,
{onSelect: onFeatureSelect, onUnselect: onFeatureUnselect});
drawControls = {
polygon: new OpenLayers.Control.DrawFeature(polygonLayer,
OpenLayers.Handler.Polygon),
select: selectControl
};

for(var key in drawControls) {
map.addControl(drawControls[key]);
}


map.setCenter(new OpenLayers.LonLat(0, 0), 3);

}

function toggleControl(element) {
for(key in drawControls) {
var control = drawControls[key];
if(element.value == key  element.checked) {
control.activate();
} else {
control.deactivate();
}
}
}

//popup end//
//selection sript end//
var dOverviewMap;



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/How-to-get-selection-with-fusion-tp4187847p5107827.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users


[mapguide-users] How to get selection with fusion??

2010-05-12 Thread lzzgeo

   I am using MGOS 2.1 with fusion, I just want to get the information about
selction through the map. 
   there are some source code in the following.



Fusion.registerForEvent(Fusion.Event.FUSION_INITIALIZED,
fusionInitialized);
Fusion.registerForEvent(Fusion.Event.FUSION_ERROR, fusionError);
Fusion.initialize();


var themap;
var fusionInitialized = function() {
$('AppContainer').resize({forceResize: true});

 themap = Fusion.getWidgetById('Map');
 themap.registerForEvent(Fusion.Event.MAP_SELECTION_ON, selectionOn);
}


var selectionOn = function()
{
 themap.getSelection(displaySelection);
}

function displaySelection(res){
var nums =res.getNumLayers();
alert(nums);
}

but, I get the message getNumLayers() is not defined. why??
Is there something wrong?

-- 
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/How-to-get-selection-with-fusion-tp5044598p5044598.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users