官方示例

This commit is contained in:
jiawanlong 2025-03-20 18:07:25 +08:00
parent 5d997af6a9
commit 866c624ec3
8 changed files with 712 additions and 12 deletions

View File

@ -1,4 +1,6 @@
/* by jiawanlong*/
var identification = {
name: "Leaflet"
};
@ -1055,7 +1057,7 @@ var exampleConfig = {
thumbnail: "8.1.5、等值面.jpg",
fileName: "8.1.5、等值面"
},
]
},
"map11cddd3233231": {

View File

@ -0,0 +1,77 @@
/* by jiawanlong*/
var identification = {
name: "Leaflet"
};
var exampleConfig = {
"base": {
name: "base",
name_en: "base",
content: {
"map": {
name: "base",
name_en: "base",
content: [
// {
// name: "1.1、默认设置",
// thumbnail: "1.1、默认设置.png",
// fileName: "1.1、默认设置"
// },
]
},
}
},
};
gallery_demos.forEach(element => {
exampleConfig.base.content.map.content.push({
name: element.name,
fileName: 'https://sandcastle.cesium.com/gallery/' + element.name + '.html',
thumbnail: 'https://sandcastle.cesium.com/gallery/' + element.img + '',
})
});
/**
*key值为exampleConfig配置的key值或者fileName值
* 为中间节点时是key值叶结点是fileName值
*value值fontawesome字体icon名
*不分层
*/
var sideBarIconConfig = {
"base": "fa-server",
"iPortal": "fa-desktop",
"Online": "fa-cloud",
"iManager": "fa-group",
"Elasticsearch": "fa-tasks",
"plot": "fa-edit",
"dynamicPlot": "fa-pencil",
"control": "fa-sliders",
"components": "fa-window-restore",
"clientSpatialAnalyst": "fa-object-group",
"viz": "fa-map",
"OGC": "fa-globe",
"mapping": "fa-send"
};
/**
*key值为exampleConfig配置的key值
*value值fontawesome字体icon名
*与sideBarIconConfig的区别sideBarIconConfig包括侧边栏所有层级目录的图标exampleIconConfig仅包括一级标题的图标
*/
var exampleIconConfig = {
"base": "fa-server",
"iPortal": "fa-desktop",
"Online": "fa-cloud",
"iManager": "fa-group",
"Elasticsearch": "fa-tasks",
"plot": "fa-edit",
"dynamicPlot": "fa-pencil",
"control": "fa-sliders",
"components": "fa-window-restore",
"clientSpatialAnalyst": "fa-object-group",
"viz": "fa-map",
"OGC": "fa-globe",
"mapping": "fa-send"
};
window.leafletExampleConfig = exampleConfig;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -89,12 +89,18 @@ function loadExampleHtml() {
if (!locationParam) {
return;
}
var href = window.location.toString();
var mapUrl = href.substr(0, href.lastIndexOf('/') + 1);
mapUrl = mapUrl + locationParam + ".html";
if (!mapUrl) {
return;
var mapUrl;
if (locationParam.indexOf('http') > -1) {
mapUrl = locationParam
}else{
var href = window.location.toString();
mapUrl = href.substr(0, href.lastIndexOf('/') + 1);
mapUrl = mapUrl + locationParam + ".html";
if (!mapUrl) {
return;
}
}
// console.log(mapUrl);
var isError = false;
var response = $.ajax({
url: mapUrl,

View File

@ -111,8 +111,14 @@ function createGalleryChart(example) {
var target = "editor.html",
defaultThumb = "../img/thumb.png",
title = utils.getLocalPairs(example, "name"),
href = example.fileName ? example.fileName : "",
thumbnail = example.thumbnail ? thumbLocation + "/img/" + example.thumbnail : "",
href = example.fileName ? example.fileName : "";
let thumbnail;
if ( example.thumbnail .indexOf('http') > -1) {
thumbnail = example.thumbnail
}else{
thumbnail = example.thumbnail ? thumbLocation + "/img/" + example.thumbnail : "";
}
// thumbnail = example.thumbnail ? thumbLocation + "/img/" + example.thumbnail : "";
version = example.version;
var chartDiv = $("<div class='col-xlg-2 col-lg-3 col-md-4 col-sm-6 col-xs-12'></div>");
@ -124,7 +130,7 @@ function createGalleryChart(example) {
}
var chartTitle = $("<h5 class='chart-title'>" + title + "</h5>");
var newTip = $('<svg xmlns="http://www.w3.org/2000/svg" class="new-example" style="width:8px !important;height:8px;right: 1px;top: 1px;position: absolute;"><circle cx="4" cy="4" r="4" fill="var(--active-color)"></circle></svg>');
var newTip = $('');
var thumb = $("<img class='chart-thumb' src='" + defaultThumb + "' data-original='" + thumbnail + "' style='display: inline'>");
chartTitle.appendTo(link);

View File

@ -161,7 +161,6 @@ function createSideBarMenuTitle(id, title, collapse, hasNewExamples) {
var titleBar = $("<span class='sidebar-title-bar'></span>");
var newIcon = "";
if (hasNewExamples) {
newIcon = "<svg style='width:16px;height:16px;padding-left:5px'><circle cx='3' cy='3' r='3' fill='var(--active-color)'></circle>/svg>";
}
var firstMenuTitle = $("<span class='firstMenuTitle'>" + title + newIcon + "</span>");
titleBar.append(firstMenuTitle);
@ -182,7 +181,6 @@ function createSideBarMenuSecondTitle(id, title, collapse, hasNewExamples) {
}
var newIcon = "";
if (hasNewExamples) {
newIcon = "<svg style='width:16px;height:16px;padding-left:5px'><circle cx='3' cy='3' r='3' fill='var(--active-color)'></circle>/svg>";
}
var div = $(
"<a href='#" + id + "' id='" + id + '-' + id + "'>" + icon +
@ -204,7 +202,6 @@ function createSideBarMenuThirdTitle(id, title, collapse,version) {
}
var newIcon="";
if(window.version===version){
newIcon = "<svg style='width:16px;height:16px;padding-left:5px'><circle cx='3' cy='3' r='3' fill='var(--active-color)'></circle>/svg>";
}
var div = $(

View File

@ -53,6 +53,9 @@
<li class="navbar-menu" id="mapboxgl-menu">
<a class="center" target="_self" href="../webgpuEx/examples.html">WebGPU Demo</a>
</li>
<li class="navbar-menu" id="mapboxgl-menu">
<a class="center" target="_self" href="../cesiumGf/examples.html">Cesium GF</a>
</li>
</ul>
</div>
</div>