Skip to content

Commit

Permalink
# This is a combination of 6 commits.tree d49629c8be1f334fd453a4725d9…
Browse files Browse the repository at this point in the history
…71b604440f421

parent eadc82f
author Jakob Miksch <[email protected]> 1598862052 +0200
committer Jakob Miksch <[email protected]> 1598862071 +0200

# This is a combination of 4 commits.
# This is the 1st commit message:

WIP

WIP - loading from JSON seems to work

# This is the commit message #2:

Cleanup

# This is the commit message #3:

Basic later tree works

# This is the commit message #4:

Feature Info works

# This is the commit message #6:

Zoom Button works
  • Loading branch information
JakobMiksch committed Aug 31, 2020
1 parent eadc82f commit 0e03e28
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 172 deletions.
2 changes: 1 addition & 1 deletion webapp/app/util/Layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ Ext.define("MalawiAtlas.util.Layer", {
});

return flatLayers;
},
}
});
34 changes: 17 additions & 17 deletions webapp/app/util/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,34 @@ var olMap = new ol.Map({
controls: ol.control.defaults({
attributionOptions: {
collapsible: false,
collapsed: false,
},
collapsed: false
}
}),
view: new ol.View({
center: ol.proj.fromLonLat([34.3, -13.2]),
zoom: 7,
}),
zoom: 7
})
});

olMap.addControl(
new ol.control.ScaleLine({
minWidth: 120,
minWidth: 120
})
);

olMap.addControl(
new ol.control.OverviewMap({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM(),
}),
],
source: new ol.source.OSM()
})
]
})
);

var measurePopup = Ext.create("GeoExt.component.Popup", {
map: olMap,
width: 140,
width: 140
});

var measureVectorSource = new ol.source.Vector();
Expand All @@ -41,20 +41,20 @@ var measureLayer = new ol.layer.Vector({
source: measureVectorSource,
style: new ol.style.Style({
fill: new ol.style.Fill({
color: "rgba(255, 20, 20, 0.2)",
color: "rgba(255, 20, 20, 0.2)"
}),
stroke: new ol.style.Stroke({
color: "#ff0033",
width: 2,
lineDash: [10, 10],
lineDash: [10, 10]
}),
image: new ol.style.Circle({
radius: 7,
fill: new ol.style.Fill({
color: "#ff0033",
}),
}),
}),
color: "#ff0033"
})
})
})
});

olMap.addLayer(measureLayer);
Expand All @@ -74,7 +74,7 @@ Ext.define("MalawiAtlas.util.Map", {
var view = me.map.getView();
view.fit(extent, {
duration: 2000,
nearest: true,
nearest: true
});
},

Expand All @@ -84,5 +84,5 @@ Ext.define("MalawiAtlas.util.Map", {
getOlMap: function () {
var me = this;
return me.map;
},
}
});
33 changes: 4 additions & 29 deletions webapp/app/view/layer/LayerTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ Ext.define("MalawiAtlas.view.layer.LayerTree", {
}
},

// empty store will be filled later
store: {},

columns: [
{
xtype: "treecolumn",
Expand Down Expand Up @@ -57,33 +60,5 @@ Ext.define("MalawiAtlas.view.layer.LayerTree", {
isDisabled: "isGroup",
handler: "showOpacitySlider"
}
],

initComponent: function () {
var me = this;

// TODO: start loading layer tree once the config JSON has been loaded

var olMap = MalawiAtlas.util.Map.getOlMap();

// TODO: use top level GeoExt function like in legend
var layerArray = [];
olMap.getLayers().forEach(function (layer) {
if (layer.get("basemap") != true && layer.get("measurementLayer") != true)
layerArray.push(layer);
});

var treeStore = Ext.create("GeoExt.data.store.LayersTree", {
layerGroup: new ol.layer.Group({
layers: layerArray
})
});

me.store = treeStore;

// uncomment, if layer tree shall be expanded
// me.expandAll();

me.callParent();
}
]
});
Loading

0 comments on commit 0e03e28

Please sign in to comment.