#1 Fri 05 November 2010 11:53
- soussou126
- Participant occasionnel
- Date d'inscription: 22 May 2010
- Messages: 21
[mapfish]afficher une liste des noeuds de ma trajectoire
Bonjour touts le monde,
je travaille avec mapfish 1.2 et j'ai une fonctionnalité qui me permet d'afficher le trajet entre de point de ma map (routing) que j'ai piqué de la documentations officiel de pgrouting http://pgrouting.postlbs.org/wiki/Works … G2008/ch03 et qui marche très bien
Code:
var selectPointControl; function selectPoint(event, element) { if (selectPointControl.active) { selectPointControl.input = null; selectPointControl.deactivate(); Ext.get(element).removeClass('x-form-trigger-click'); } else { selectPointControl.input = this; selectPointControl.activate(); Ext.get(element).addClass('x-form-trigger-click'); } } function pointSelected(feature) { if (feature) { if (this.input && !feature.input) { for (var i = 0; i < feature.layer.features.length; i++) { var f = feature.layer.features[i]; if (f.input == this.input) { feature.layer.removeFeatures([f]); break; } } feature.input = this.input; // set the feature style if (feature.input.name == 'source') { feature.style = mapfish.Routing.firstPointStyle; } else if (feature.input.name == 'target') { feature.style = mapfish.Routing.lastPointStyle; } feature.layer.redraw(); } var lonlat = new OpenLayers.LonLat(feature.geometry.x, feature.geometry.y); lonlat.transform(this.map.getProjectionObject(), this.displayProjection); var point = new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat); feature.input.setValue(point.toString()); selectPointControl.deactivate(); Ext.get(feature.input.trigger).removeClass('x-form-trigger-click'); } } var routing = new mapfish.Routing('routes/routing', map, { fetchRoute : function(button, event) { var form = button.ownerCt.getForm(); var feat; if (form.isValid()) { feat = mapfish.Routing.prototype.fetchRoute.call(this, form .getValues()); } this.parser = new OpenLayers.Format.GeoJSON({ internalProjection : this.map.projection, externalProjection : this.map.displayProjection }); } }); var selectPointLayer = new OpenLayers.Layer.Vector("point select", { displayInLayerSwitcher : false }); map.addLayer(selectPointLayer); selectPointControl = new OpenLayers.Control.DrawFeature(selectPointLayer, OpenLayers.Handler.Point, { featureAdded : pointSelected }); map.addControl(selectPointControl); var dragFeature = new OpenLayers.Control.DragFeature(selectPointLayer, { onComplete : pointSelected }); map.addControl(dragFeature); dragFeature.activate(); var routingPanel = { title : 'Routing', xtype : 'form', defaultType : 'combo', defaults : { width : 170, listWidth : 160, allowBlank : false, onTriggerClick : selectPoint, triggerClass : 'x-form-search-trigger' }, items : [{ fieldLabel : 'Departure', name : 'source' }, { fieldLabel : 'Arrival', name : 'target' }], buttons : [{ text : 'Show Itinerary', handler : routing.fetchRoute, scope : routing }] };
je veux ajouter une liste des différents nœuds par le quel passe mon trajet, mais je ne sais pas comment mis prendre!!
il y a t'il quelqu'un qui peut m'aider!
merci
Hors ligne