- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
请先阅读理解然后使用react。现在的人在不了解实际问题的情况下就给出负面评价。
如果您需要更多信息,请询问我。
传单版本:传单 1.0.2,*我在这里使用map-box插件是为了更好的CDN访问。
我已经使用 GeoJSON 成功创建了控制图层组和自定义圆形标记组。
这是来源:
L.mapbox.accessToken = 'pk.eyJ1IjoiZG9zcyIsImEiOiI1NFItUWs4In0.-9qpbOfE3jC68WDUQA1Akg';
var map = L.mapbox.map('mapbox', 'mapbox.light').setView([22.9867569, 87.8549755], 9);
var baselayer = {};
var initialContent = {};
var myGeometry = JSON.stringify({
"features": [{
"type": "Feature",
"properties": {
"pname": "66_marker",
"action": "B",
"name": "AAA",
"photo": "",
"comment": "",
"fac_type": "",
"val_6": 1,
"val_7": 333333,
"val_8": "",
"val_9": "",
"val_10": "",
"val_11": "",
"val_12": "",
"val_13": "",
"val_14": "",
"val_15": "",
"val_16": "",
"val_17": "",
"val_18": "",
"val_19": "",
"val_20": "",
"id": 66,
"user_id": 1
},
"geometry": {
"type": "Point",
"coordinates": [88.266906738281, 22.793907258499]
}
}, {
"type": "Feature",
"properties": {
"pname": "73_marker",
"action": "A",
"name": "WW",
"photo": "",
"comment": "",
"fac_type": "",
"val_6": 1,
"val_7": 333333,
"val_8": "",
"val_9": "",
"val_10": "",
"val_11": "",
"val_12": "",
"val_13": "",
"val_14": "",
"val_15": "",
"val_16": "",
"val_17": "",
"val_18": "",
"val_19": "",
"val_20": "",
"id": 73,
"user_id": 1
},
"geometry": {
"type": "Point",
"coordinates": [88.360290527344, 22.692586244731]
}
}, {
"type": "Feature",
"properties": {
"pname": "78_marker",
"action": "b",
"name": "BBB",
"photo": "",
"comment": "",
"fac_type": "",
"val_6": 1,
"val_7": 333333,
"val_8": "",
"val_9": "",
"val_10": "",
"val_11": "",
"val_12": "",
"val_13": "",
"val_14": "",
"val_15": "",
"val_16": "",
"val_17": "",
"val_18": "",
"val_19": "",
"val_20": "",
"id": 78,
"user_id": 1
},
"geometry": {
"type": "Point",
"coordinates": [88.887634277344, 22.872379306788]
}
}, {
"type": "Feature",
"properties": {
"pname": "83_marker",
"action": "Q",
"name": "SSS",
"photo": "",
"comment": "",
"fac_type": "",
"val_6": 1,
"val_7": 333333,
"val_8": "",
"val_9": "",
"val_10": "",
"val_11": "",
"val_12": "",
"val_13": "",
"val_14": "",
"val_15": "",
"val_16": "",
"val_17": "",
"val_18": "",
"val_19": "",
"val_20": "",
"id": 83,
"user_id": 1
},
"geometry": {
"type": "Point",
"coordinates": [88.689880371094, 22.978623970385]
}
}, {
"type": "Feature",
"properties": {
"pname": "88_marker",
"action": "A",
"name": "WW",
"photo": "",
"comment": "",
"fac_type": 1,
"val_6": 1,
"val_7": 333333,
"val_8": "",
"val_9": "",
"val_10": "",
"val_11": "",
"val_12": "",
"val_13": "",
"val_14": "",
"val_15": "",
"val_16": "",
"val_17": "",
"val_18": "",
"val_19": "",
"val_20": "",
"id": 88,
"user_id": 1
},
"geometry": {
"type": "Point",
"coordinates": [88.401489257812, 22.935630216775]
}
}, {
"type": "Feature",
"properties": {
"pname": "93_marker",
"action": "C",
"name": "qqq",
"photo": "",
"comment": "",
"fac_type": 1,
"val_6": 1,
"val_7": 333333,
"val_8": "",
"val_9": "",
"val_10": "",
"val_11": "",
"val_12": "",
"val_13": "",
"val_14": "",
"val_15": "",
"val_16": "",
"val_17": "",
"val_18": "",
"val_19": "",
"val_20": "",
"id": 93,
"user_id": 1
},
"geometry": {
"type": "Point",
"coordinates": [88.547058105469, 22.85719470097]
}
}, {
"type": "Feature",
"properties": {
"pname": "98_marker",
"action": "AA",
"name": "QQ",
"photo": "",
"comment": "",
"fac_type": 1,
"val_6": 1,
"val_7": 22222,
"val_8": "",
"val_9": "",
"val_10": "",
"val_11": "",
"val_12": "",
"val_13": "",
"val_14": "",
"val_15": "",
"val_16": "",
"val_17": "",
"val_18": "",
"val_19": "",
"val_20": "",
"id": 98,
"user_id": 1
},
"geometry": {
"type": "Point",
"coordinates": [88.118591308594, 22.791375149054]
}
}, {
"type": "Feature",
"properties": {
"pname": "62_marker",
"action": "GG",
"name": "Kuntal",
"photo": "1477902102_Street_-_Kolkata_2011-07-27_00417.jpg",
"comment": "This is Kolkata",
"fac_type": 8,
"val_6": 1,
"val_7": 9830264337,
"val_8": "HH",
"val_9": 9754875,
"val_10": "d@ajdh.com",
"val_11": "",
"val_12": "",
"val_13": "",
"val_14": "",
"val_15": "",
"val_16": "",
"val_17": "",
"val_18": "",
"val_19": "",
"val_20": "",
"id": 62,
"user_id": 1
},
"geometry": {
"type": "Point",
"coordinates": [87.896118164062, 22.748322097622]
}
}, {
"type": "Feature",
"properties": {
"pname": "77_polygon",
"action": 1,
"name": "",
"photo": "",
"comment": "",
"fac_type": "",
"val_6": "",
"val_7": "",
"val_8": "",
"val_9": "",
"val_10": "",
"val_11": "",
"val_12": "",
"val_13": "",
"val_14": "",
"val_15": "",
"val_16": "",
"val_17": "",
"val_18": "",
"val_19": "",
"val_20": "",
"id": 77,
"user_id": 1
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[88.302773237228, 22.684419907565],
[88.30274105072, 22.684122940681],
[88.303438425064, 22.683954659161],
[88.303513526917, 22.684281323099],
[88.303191661835, 22.684311019782],
[88.302773237228, 22.684419907565]
]
]
}
}, {
"type": "Feature",
"properties": {
"pname": "94_polygon",
"action": 2,
"name": "",
"photo": "",
"comment": "",
"fac_type": "",
"val_6": "",
"val_7": "",
"val_8": "",
"val_9": "",
"val_10": "",
"val_11": "",
"val_12": "",
"val_13": "",
"val_14": "",
"val_15": "",
"val_16": "",
"val_17": "",
"val_18": "",
"val_19": "",
"val_20": "",
"id": 94,
"user_id": 1
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[88.305047750473, 22.685221714938],
[88.304886817932, 22.68493464864],
[88.305455446243, 22.684598087387],
[88.305659294128, 22.684974244027],
[88.305047750473, 22.685221714938]
]
]
}
}, {
"type": "Feature",
"properties": {
"pname": "69_marker",
"action": "y",
"name": "",
"photo": "",
"comment": "",
"fac_type": 1,
"val_6": "",
"val_7": "",
"val_8": "",
"val_9": "",
"val_10": "",
"val_11": "",
"val_12": "",
"val_13": "",
"val_14": "",
"val_15": "",
"val_16": "",
"val_17": "",
"val_18": "",
"val_19": "",
"val_20": "",
"id": 69,
"user_id": 1
},
"geometry": {
"type": "Point",
"coordinates": [88.304752707481, 22.683890316173]
}
}, {
"type": "Feature",
"properties": {
"pname": "73_marker",
"action": "r",
"name": "",
"photo": "",
"comment": "",
"fac_type": 1,
"val_6": "",
"val_7": "",
"val_8": "",
"val_9": "",
"val_10": "",
"val_11": "",
"val_12": "",
"val_13": "",
"val_14": "",
"val_15": "",
"val_16": "",
"val_17": "",
"val_18": "",
"val_19": "",
"val_20": "",
"id": 73,
"user_id": 1
},
"geometry": {
"type": "Point",
"coordinates": [88.304173350334, 22.684276373652]
}
}]
});
var myGeoJSON = JSON.parse(myGeometry);
var geoJsonGroup = L.geoJson(myGeoJSON);
var categories = {},
fac_type;
var myStyle = {
fillOpacity: 1,
stroke: false,
weight: 1,
opacity: 1,
fill: true,
clickable: true
};
var geoJsonGroup = new L.geoJson(myGeoJSON, {
style: function(feature) {
switch (feature.properties.pname) {
case '66_marker':
return {
color: "yellow"
};
case '73_marker':
return {
color: "blue"
};
case '62_marker':
return {
color: "redMarker"
};
case '77_polygon':
return {
color: "red"
};
}
},
pointToLayer: function(feature, latlng) {
return new L.CircleMarker(latlng, myStyle);
},
onEachFeature: function(feature, layer) {
var layers = layer;
var initialContent = document.createElement("div");
initialContent.className = "content-scroll6";
initialContent.innerHTML = "<table class='table table-striped'><tr><td>POI_NAME</td><td>" + feature.properties.name + "</td></tr>" + "<tr><td>FAC_TYPE</td><td><a id='fac_type'></a></td></tr>" + "<tr><td>SUBCAT</td><td>" + feature.properties.val_6 + "</td></tr>" + "<tr><td>PH_NUMBER</td><td>" + feature.properties.val_7 + "</td></tr>" + "<tr><td>HNO</td><td>" + feature.properties.val_8 + "</td></tr>" + "<tr><td>POSTCODE</td><td>" + feature.properties.val_9 + "</td></tr>" + "<tr><td>MAIL</td><td>" + feature.properties.val_10 + "</td></tr>" + "<tr><td>STR_NM</td><td>" + feature.properties.val_11 + "</td></tr>" + "<tr><td>PHOTO</td><td ><img src='uploads/" + feature.properties.photo + "' class='inImg'></td></tr>" + "<tr><td>COMMENT</td><td>" + feature.properties.comment + "</td></tr>" + "<tr><td>URL</td><td>" + feature.properties.val_12 + "</td></tr>" + "<tr><td>SUB_LOC</td><td>" + feature.properties.val_13 + "</td></tr>" + "<tr><td>LOCALITY</td><td>" + feature.properties.val_14 + "</td></tr>" + "<tr><td>Val 15</td><td>" + feature.properties.val_15 + "</td></tr>" + "<tr><td>Val 16</td><td>" + feature.properties.val_16 + "</td></tr>" + "<tr><td>Val 17</td><td>" + feature.properties.val_17 + "</td></tr>" + "<tr><td>Val 18</td><td>" + feature.properties.val_18 + "</td></tr>" + "<tr><td>Val 19</td><td>" + feature.properties.val_19 + "</td></tr>" + "<tr><td>Val 20</td><td>" + feature.properties.val_20 + "</td></tr></table>";
layer.bindPopup(initialContent);
fac_type = feature.properties.pname;
// Initialize the category array if not already set.
if (typeof categories[fac_type] === "undefined") {
categories[fac_type] = [];
}
categories[fac_type].push(layer);
}
}).addTo(map);
var overlaysObj = {},
categoryName,
categoryArray,
categoryLG;
for (categoryName in categories) {
categoryArray = categories[categoryName];
categoryLG = L.layerGroup(categoryArray);
categoryLG.categoryName = categoryName;
overlaysObj[categoryName] = categoryLG;
}
// Create an empty LayerGroup that will be used to emulate adding / removing all categories.
var allPointsLG = L.layerGroup();
overlaysObj["All Points"] = allPointsLG;
var control = L.control.layers(baselayer, overlaysObj, {
collapsed: false
}).addTo(map);
// Make sure the Layers Control checkboxes are kept in sync with what is on map.
// For some reason this control does not sync its checkboxes with the map state by itself, whereas it does with Leaflet 0.7.x?
map.on("overlayadd overlayremove", function(event) {
var layer = event.layer,
layerCategory;
if (layer === allPointsLG) {
if (layer.notUserAction) {
// allPointsLG has been removed just to sync its state with the fact that at least one
// category is not shown. This event does not come from a user un-ticking the "All points" checkbox.
layer.notUserAction = false;
return;
}
// Emulate addition / removal of all category LayerGroups when allPointsLG is added / removed.
for (var categoryName in overlaysObj) {
if (categoryName !== "All Points") {
if (event.type === "overlayadd") {
overlaysObj[categoryName].addTo(map);
} else {
map.removeLayer(overlaysObj[categoryName]);
}
}
}
control._update();
} else if (layer.categoryName && layer.categoryName in overlaysObj) {
if (event.type === "overlayadd") {
// Check if all categories are shown.
for (var categoryName in overlaysObj) {
layerCategory = overlaysObj[categoryName];
if (categoryName !== "All Points" && !layerCategory._map) {
// At least one category is not shown, do nothing.
return;
}
}
allPointsLG.addTo(map);
control._update();
} else if (event.type === "overlayremove" && allPointsLG._map) {
// Remove allPointsLG as at least one category is not shown.
// But register the fact that this is purely for updating the checkbox, not a user action.
allPointsLG.notUserAction = true;
map.removeLayer(allPointsLG);
control._update();
}
}
});
body {
margin: 0;
}
html,
body,
#mapbox {
height: 100%;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="https://api.mapbox.com/mapbox.js/v2.2.2/mapbox.js"></script>
<link href="https://api.mapbox.com/mapbox.js/v2.2.2/mapbox.css" rel="stylesheet"/>
<body>
<div id="mapbox"></div>
</body>
我想做的是:1. 自定义标记的图标,而不是像您现在看到的那样颜色不同。
2.在Control图层上添加不同的Icon。示例图片:
最佳答案
看看这个 example用于创建自定义传单标记。
这个想法是,您可以使用自定义图标图像创建标记,而不是将标记点转换为 L.circleMarker。
由于听起来您将有多个图标,因此最好创建一个图标类:
var myIcon = L.Icon.extend({
options: {
iconSize: [38, 95],
iconAnchor: [22, 94],
popupAnchor: [-3, -76]
}
});
然后,当您实例化图标时,您可以设置自定义图标图像。
var firstIcon = new myIcon({iconUrl: 'first-icon.png'}),
anotherIcon = new myIcon({iconUrl: 'another-icon.png'}),
yetAnotherIcon = new myIcon({iconUrl: 'tet-another.png'});
pointToLayer: function(feature, latlng) {
if(feature.properties.pname == '66_marker'){
return L.marker(latlng, {icon: firstIcon});
} else if (feature.properties.pname == '73_marker'){
return L.marker(latlng, {icon: anotherIcon});
}
}
要为图层控件创建自定义图标,您可以在 css 中创建图标类。当您将图层添加到图层控件时,您可以添加图标。
overlaysObj[categoryName] = '<span class="custom-icon"></span>' + categoryLG;
祝你好运。
关于javascript - 根据要素类型(属性)控制图层图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41075447/
我从来没有遇到过这种问题 - 我也不知道为什么.. 有些图标丢失并以“?/!”闪烁显示 发生了什么事? 它是一个提交按钮。我在另一个按钮中有相同的图标 - 那里没问题。 SIGN! 有什
我只需要在单击按钮时显示 ionic 图标。 我试着在那个图标上放一个类并做到了: .icn { visibility: visible; } 但是没有用,有没有人知道另一种方法? 最佳答案 Sho
我用qt在托盘里做了一个应用。在我的电脑上,这是一个很好的项目,我在托盘栏中看到了图标,但是当我将其发布给其他人时,他们看不到该图标,它只是一个可以使用但不显示图标的隐形方 block 。但在我的电脑
我想使用delphi将图标/ bmp绘制到TListView的子项中。但是我不知道该怎么做到。它适用于列表中的第一项,但子项存在问题。 最佳答案 您可以使用CustomDrawSubItem事件。 下
我想将标题栏中的图标设置为应用程序的图标 [[myWindow standardWindowButton:NSWindowDocumentIconButton] setImage:[NSApp app
可以设置一个图标,以便在当前应用程序的每个窗口上使用它。这样我就设置了一次(不是手动在每个窗口上设置)..? 最佳答案 关于这个主题的一个很好的引用在这里 MSDN 。表明您有一个应用程序图标(桌面图
我为自己制作了一个小书签,它的功能很好,但当添加到 Opera 或 Firefox 的工具栏时,它只是呈现浏览器的默认书签图标(分别是地球仪和星星)。我的网站有一个网站图标,窗口、选项卡甚至 [网站]
制表符中的responsiveCollapse 折叠展开功能的默认图标似乎未居中。是否有更改此图标的选项。也许是右下胡萝卜? 最佳答案 responsiveCollapse 格式化程序只是一个像所有其
上面是下拉列表,当单击列表时,其值将与图像一起显示在上面的字段(顺便说一句,这是一个按钮)中。我已经实现了显示文本,但似乎无法显示图像。这是我的标记如下... 广东 @foreach
我想将我们数据库中的电线杆和电缆导出到 Google 地球的 KML 文件中。 对于每个节点,我们都有一个极阵列,电缆始终连接到阵列中的下一个极。 制作简单路径的导出似乎很容易。但是这些路径只是显示一
我想将我们数据库中的电线杆和电缆导出到 Google 地球的 KML 文件中。 对于每个节点,我们都有一个极阵列,电缆始终连接到阵列中的下一个极。 制作简单路径的导出似乎很容易。但是这些路径只是显示一
在 JTable 中显示数据。一列用作字段复选框。问题是在显示ChceckBox 中而不是出现图标true/false。我该如何解决这个问题? 添加数据: private DefaultTableMo
[编辑] 我想使用 DataTable 在 Datagridview 中使用图像。 RadioButton 只是这篇文章的一种简单问题格式。 让我为此澄清一下。 如何使用绑定(bind)样式在 dat
我正在使用 C# 开发 win 表单应用程序。我遇到了一个需要向用户提供 ComboBox 的场景。现在,为了使外观更具吸引力,我想在该组合框的每个项目之前显示一个小图像或图标。 我查看了一些提供此功
我正在 CrossRider 中构建一个扩展。我需要在数据库中保存我有它们的 url 的图像/图标。它们是微小的图像,不会成为数据库中的问题。我可能有类似的东西可以访问 background.js:
我需要使用我的 JavaFX 应用程序中的一些元素,这些元素使用 带有自定义符号/图标的按钮 横幅或背景图像。 此应用程序应该在具有不同屏幕分辨率的多个设备上运行,并且我还(最终)需要缩放图像/图标(
我怎样才能在 android studio 中做这样的事情: 我想要一个导航栏,您可以在其中看到名称、图标以及打开抽屉导航的机会 :D (图片是用Figma制作的) 最佳答案 将重力设置为在 Draw
当我在 ViewPager 中滑动 fragment 时,如何动态更改 Action Bar 的操作按钮图标。取决于 fragment 按钮必须改变状态(图标)。 最佳答案 您可以在 onPrepar
我有两个 while 循环,一个是循环遍历聊天日志以检索日期、用户名、消息,另一个 while 循环 是从单独的表中检索图标这有两列 chars 和 image (image-name.*) 我可以显
我正在尝试重新启动 mysql(一个完全不同的问题),MySql 肯定已安装(版本 14.14),并且根据我收集的信息,我应该在系统偏好设置面板的底部看到它的图标,但它是不在那里。安装过程中是否出现了
我是一名优秀的程序员,十分优秀!