Project

General

Profile

« Previous | Next » 

Revision 5928

add custom Pan/Zoom/Query control. http://bugzilla.ecoinformatics.org/show_bug.cgi?id=2188

View differences:

lib/style/common/spatial/map.js
50 50

  
51 51
	map.addLayers([demis, sanparks_boundaries, jpl_wms, ol_wms, world_borders, metacat_points, metacat_bounds]);	
52 52

  
53
	// some built-in controls
54
	map.addControl(new OpenLayers.Control.MouseToolbar());
55
    map.addControl(new OpenLayers.Control.LayerSwitcher());
56
    map.addControl(new OpenLayers.Control.MousePosition());
57

  
58 53
    // get the drag box event
59
	control = new OpenLayers.Control();
54
	//control = new OpenLayers.Control();
55
	control = new OpenLayers.Control({title: "Spatial query (Shift+Drag)", displayClass: "spatialQuery"});
60 56
	OpenLayers.Util.extend(
61 57
			control, {
62 58
			    draw: function () {
63 59
			        // this Handler.Box will intercept the shift-mousedown
64 60
			        // before Control.MouseDefault gets to see it
65 61
			        this.box = new OpenLayers.Handler.Box( control,
66
			            {"done": this.notice}
67
		            	//,{keyMask: OpenLayers.Handler.MOD_SPACE}
68
	            	);
62
			        		{"done": this.notice}
63
                            //,{keyMask: OpenLayers.Handler.MOD_SHIFT}
64
			        		);
69 65
			        this.box.activate();
70 66
			    },
71 67
			    notice: function (bounds) {
......
93 89
				
94 90
			    }
95 91
	});
96
	map.addControl(control);
97
	
92
	var tb = OpenLayers.Class(OpenLayers.Control.NavToolbar, {
93
		initialize: function() {
94
			var options = null;
95
			OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]);
96
			this.addControls([
97
			                  new OpenLayers.Control.Navigation({'zoomWheelEnabled': false}),
98
			                  new OpenLayers.Control.ZoomBox(),
99
			                  control
100
			                  ]);
101
		}
102
	});
103
	map.addControl(new tb());
104
	//map.addControl(control);
105

  
106
	// some built-in controls
107
	//map.addControl(new OpenLayers.Control.NavToolbar());
108
	map.addControl(new OpenLayers.Control.LayerSwitcher());
109
	map.addControl(new OpenLayers.Control.MousePosition());
110

  
98 111
	// zoom to center
99 112
    if (!map.getCenter()) {
100 113
         map.zoomToMaxExtent();
lib/style/common/spatial/map.jsp
44 44
            height: 380px;
45 45
            border: 1px solid #cccccc;
46 46
        }
47
        .olControlNavToolbar .spatialQueryItemActive { 
48
        	background-image: url("<%=STYLE_COMMON_URL%>/spatial/metacat-query-on.png");
49
		  	background-repeat: no-repeat;
50
		}
51
		.olControlNavToolbar .spatialQueryItemInactive { 
52
        	background-image: url("<%=STYLE_COMMON_URL%>/spatial/metacat-query-off.png");
53
		  	background-repeat: no-repeat;
54
		}
55
		
56

  
47 57
    </style>
48 58
    <script src="http://www.openlayers.org/api/OpenLayers.js"></script>
49 59
    <script src="<%=STYLE_COMMON_URL%>/spatial/map.js"></script>

Also available in: Unified diff