作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试开发在网络上覆盖图层的框架。为此,我使用 geoserver 来发布图层,使用 geoext tree.js 示例来显示树状面板中的所有图层。但我遇到了放大和缩小的问题。当我使用 Geoext tree.js 示例时,我尝试使用此示例覆盖图层,该图层在最大范围内放大和缩小。在下图中,它被清除。
var mapPanel, tree;
Ext.application({
name: 'Tree',
launch: function() {
mapPanel = Ext.create('GeoExt.panel.Map', {
border: true,
region: "center",
map: {allOverlays: false},
center: [74.60,16.84],
zoom: 15,
layers: [
new OpenLayers.Layer.WMS("Wi-Fi",
"http://localhost:8082/geoserver/NewProject/wms", {
layers: "wi-fi antena",
transparent: true,
format: "image/png"
}, {
singleTile: true,
visibility: false
}
),
new OpenLayers.Layer.WMS("Water Cooler",
"http://localhost:8082/geoserver/NewProject/wms", {
layers: "water cooler",
transparent: true,
format: "image/png"
}, {
singleTile: true,
visibility: false
}
),
new OpenLayers.Layer.WMS("Solar Pole",
"http://localhost:8082/geoserver/NewProject/wms", {
layers: "solar pole",
transparent: true,
format: "image/png"
}, {
singleTile: true,
visibility: false
}
),
new OpenLayers.Layer.WMS("Roads",
"http://localhost:8082/geoserver/NewProject/wms", {
layers: "road",
transparent: true,
format: "image/png"
}, {
singleTile: true,
visibility: false
}
),
new OpenLayers.Layer.WMS("Optical Fiber Line",
"http://localhost:8082/geoserver/NewProject/wms",
{
layers: 'optical fiber line',
format: 'image/png',
transparent: true
},
{
singleTile: true,
visibility: false
}
),
new OpenLayers.Layer.WMS("Dustbin",
"http://localhost:8082/geoserver/NewProject/wms", {
layers: "dustbin",
transparent: true,
format: "image/png"
}, {
singleTile: true,
visibility: false
}
),
new OpenLayers.Layer.WMS("Drainage Line",
"http://localhost:8082/geoserver/NewProject/wms",
{
layers: 'drainage line',
format: 'image/png',
transparent: true
},
{
singleTile: true,
visibility: false
}
),
new OpenLayers.Layer.WMS("Contour",
"http://localhost:8082/geoserver/NewProject/wms",
{
layers: 'contour',
format: 'image/png',
transparent: true
},
{
singleTile: true,
visibility: false
}
),
new OpenLayers.Layer.WMS("Building",
"http://localhost:8082/geoserver/NewProject/wms",
{
layers: 'building',
format: 'image/png',
transparent: true
},
{
singleTile: true,
visibility: false
}
),
new OpenLayers.Layer.WMS("College",
"http://localhost:8082/geoserver/NewProject/wms", {
layers: "areaofcollege",
format: "image/png8"
}, {
buffer: 0,
singleTile: true,
visibility: false
}
),
]
});
var store = Ext.create('Ext.data.TreeStore', {
model: 'GeoExt.data.LayerTreeModel',
root: {
expanded: true,
children: [
{
plugins: [{
ptype: 'gx_layercontainer',
store: mapPanel.layers
}],
expanded: true
},
]
}
});
// create the tree with the configuration from above
tree = Ext.create('GeoExt.tree.Panel', {
border: true,
region: "west",
title: "Layers",
width:200,
split: true,
collapsible: true,
collapseMode: "mini",
autoScroll: true,
store: store,
rootVisible: false,
lines: false,
});
Ext.create('Ext.Viewport', {
layout: "fit",
hideBorders: true,
items: {
layout: "border",
deferredRender: false,
items: [mapPanel, tree, {
contentEl: "search",
region: "east",
bodyStyle: {"padding": "5px"},
collapsible: true,
collapseMode: "mini",
split: true,
width: 200,
title: "Search"
}]
}
});
}
});
<!DOCTYPE html>
<html>
<head>
<title>WCE Campus</title>
<!-- ExtJS -->
<script type="text/javascript" src="include-ext.js"></script>
<!-- Basic example styling -->
<link rel="stylesheet" type="text/css" href="examples.css" />
<link rel="stylesheet" type="text/css" href="Libs/geoext2-2.1.0/resources/css">
<!-- You should definitely consider using a custom single-file version of OpenLayers -->
<script src="Libs/OpenLayers-2.13.1/OpenLayers.js"></script>
<script type="text/javascript" src="loader.js"></script>
<script type="text/javascript" src="tree.js"></script>
</head>
<body>
<div id="search">
</div>
</body>
</html>
最佳答案
您应该尝试设置自己的缩放级别。看看the doc here .
关于javascript - 关于geoext,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35646954/
已关闭。这个问题是 off-topic 。目前不接受答案。 想要改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 已关闭10 年前。 Improve th
我想在整个页面上设置一个 mask ,直到整个页面完全加载后才将其移除。更具体地说,我有一个用 OpenLayers 和 GeoExt 创建的 map ,我正在尝试使用 ExtJS loadMask。
我正在尝试向 GeoExt 应用程序添加一个按钮。理想情况下,我希望按钮工作流程是: 用户点击按钮。按钮现已“切换”为打开状态。 用户点击 map 上的某处。 (这总是有效)调用按钮后面的函数。 按钮
我正在尝试使用 GeoEXT 和 geoserver 打印 map ,我成功显示了打印面板,但是当我单击打印按钮时出现此错误: Error while generating PDF: o
我是一名优秀的程序员,十分优秀!