Skip to content

Commit

Permalink
#25 pick selectable layers
Browse files Browse the repository at this point in the history
  • Loading branch information
gyuque committed Feb 25, 2014
1 parent 0cb7209 commit 3020156
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
11 changes: 9 additions & 2 deletions inner/js/model/MMLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ if (!window.mobmap) { window.mobmap={}; }

(function(aGlobal) {
'use strict';
var gLayerNextId = 1;
aGlobal.mobmap.layerGetNextId = function() {
var i = gLayerNextId++;
return i;
};

var LayerEvent = {
LoadWillStart: 'mm-layer-model-event-load-will-start',
Expand All @@ -12,14 +17,16 @@ if (!window.mobmap) { window.mobmap={}; }
};

var LayerCapability = {
MarkerRenderable: 0x01
MarkerRenderable: 0x01,
SpatialSelectable: 0x10
};

function MovingObjectLayer() {
this.layerId = mobmap.layerGetNextId();
this.jElement = $(document.createElement('span'));
this.ownerList = null;
this.primaryView = null;
this.capabilities = LayerCapability.MarkerRenderable;
this.capabilities = LayerCapability.MarkerRenderable | LayerCapability.SpatialSelectable;
this.dataTimeRange = {
start: 0,
end: 0
Expand Down
1 change: 1 addition & 0 deletions inner/js/model/MMMeshLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ if (!window.mobmap) { window.mobmap={}; }
'use strict';

function MMMeshLayer() {
this.layerId = mobmap.layerGetNextId();
this.jElement = $(document.createElement('span'));
this.ownerList = null;
this.primaryView = null;
Expand Down
4 changes: 4 additions & 0 deletions inner/js/model/MMProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ if (!window.mobmap) { window.mobmap={}; }
eventDispatcher: function() {
return this.jElement;
},

getLayerList: function() {
return this.layerList;
},

addMovingObjectLayer: function() {
var lyr = new mobmap.MovingObjectLayer();
Expand Down
8 changes: 8 additions & 0 deletions inner/js/selection/selection-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ if (!window.mobmap) { window.mobmap={}; }
},

makeIDCollection: function(targetProject) {
var ls = targetProject.getLayerList();
var len = ls.getCount();

for (var i = 0;i < len;++i) {
var lyr = ls.getLayerAt(i);
if (lyr.capabilities & mobmap.LayerCapability.SpatialSelectable) {
console.log("layer selection");
}
}
},

// - - - - - - - - - -
Expand Down

0 comments on commit 3020156

Please sign in to comment.