主頁 > 企業開發 > 通過openlayers加載dwg格式的CAD圖并與互聯網地圖疊加

通過openlayers加載dwg格式的CAD圖并與互聯網地圖疊加

2022-10-17 07:44:37 企業開發

Openlayers介紹

? Openlayers是一個基于Javacript開發,免費、開源的前端地圖開發庫,使用它,可以很容易的開發出WebGIS系統,目前Openlayers支持地圖瓦片、矢量資料等眾多地圖資料格式,支持比較完整的地圖互動操作,目前OpenLayers已經成為一個擁有眾多開發者和幫助社區的成熟、流行的框架,在國內外的GIS相關行業中得到了廣泛的應用,

openlayers 官網地址 https://openlayers.org/

openlayers 原始碼地址 https://github.com/openlayers/openlayers

Openlayers中加載CAD柵格瓦片

image-20221016204713951

// 地圖服務物件,呼叫唯杰地圖服務打開地圖,獲取地圖的元資料
let svc = new vjmap.Service(env.serviceUrl, env.accessToken)
// 打開地圖
let mapId = "sys_zp";
let res = await svc.openMap({
    mapid: mapId, // 地圖ID
    mapopenway: vjmap.MapOpenWay.GeomRender, // 以幾何資料渲染方式打開
    style: vjmap.openMapDarkStyle() // div為深色背景顏色時,這里也傳深色背景樣式
})
if (res.error) {
    // 如果打開出錯
    message.error(res.error)
}
// 獲取地圖范圍
let mapBounds = vjmap.GeoBounds.fromString(res.bounds);

//自定義投影引數
let cadProjection = new ol.proj.Projection({
    // extent用于確定縮放級別
    extent: mapBounds.toArray(),
    units: 'm'
});
// 設定每級的解析度
let resolutions= [];
for(let i = 0; i < 25; i++) {
    resolutions.push(mapBounds.width() / (512 * Math.pow(2, i - 1)))
}
// 增加自定義的cad的坐標系
ol.proj.addProjection(cadProjection);

// 創建openlayer的地圖物件
let map = new ol.Map({
    target: 'map', // div的id
    view: new ol.View({
        center: mapBounds.center().toArray(),  // 地圖中心點
        projection: cadProjection, // 剛自定義的cad的坐標系
        resolutions:resolutions, // 解析度
        zoom: 2// 初始縮放級別
    })
});

// 增加一個瓦片圖層
let layer = new ol.layer.Tile({
    // 增加一個瓦片資料源
    source: new ol.source.TileImage({
        url: svc.rasterTileUrl() // 唯杰地圖服務提供的cad的柵格瓦片服務地址
    })
});
// 在地圖中增加上面的瓦片圖層
map.addLayer(layer);

Openlayers中加載CAD矢量瓦片


// 增加一個矢量瓦片圖層
let layer = new ol.layer.VectorTile({
    // 增加一個瓦片資料源
    source: new ol.source.VectorTile({
        projection: cadProjection,
        format: new ol.format.MVT(),
        url: svc.vectorTileUrl() // 唯杰地圖服務提供的cad的矢量瓦片服務地址
    }),
    style: createVjMapVectorStyle(ol.style.Style, ol.style.Fill, ol.style.Stroke, ol.style.Circle)
});
// 在地圖中增加上面的瓦片圖層
map.addLayer(layer);

Openlayers中選擇高亮CAD物體

olselectHighlight.gif


const highlight_ent = async co => {
    vectorSource.clear();
    let res = await svc.pointQueryFeature({
        x: co[0],
        y: co[1],
        zoom: map.getView().getZoom(),
        fields: ""
    }, pt => {
        // 查詢到的每個點進行坐標處理回呼
        return mapPrj.fromMercator(pt);// 轉成cad的坐標
    })
    if (res && res.result && res.result.length > 0) {
        let features = [];
        for (let ent of res.result) {
            if (ent.geom && ent.geom.geometries) {
                let clr = vjmap.entColorToHtmlColor(ent.color);
                for (let g = 0; g < ent.geom.geometries.length; g++) {
                    features.push({
                        type: "Feature",
                        properties: {
                            objectid: ent.objectid + "_" + g,
                            color: clr,
                            alpha: ent.alpha / 255,
                            lineWidth: 1,
                            name: ent.name,
                            isline: ent.isline,
                            layerindex: ent.layerindex
                        },
                        geometry: ent.geom.geometries[g]
                    })
                }
                // 選擇提示
                let content = `feature: ${ent.objectid}; layer: ${cadLayers[ent.layerindex].name}; type: ${ent.name}`
                message.info({ content, key: "info", duration: 3});
            }
        }
        geojsonObject.features = features;
        if (geojsonObject.features.length > 0) {
            vectorSource.addFeatures( new ol.format.GeoJSON().readFeatures(geojsonObject, {dataProjection: cadProjection}))
        }
    }
};

Openlayers中上傳打開CAD的DWG圖形

oluploadmap.gif


// 地圖服務物件,呼叫唯杰地圖服務打開地圖,獲取地圖的元資料
let svc = new vjmap.Service(env.serviceUrl, env.accessToken)

// 上傳dwg檔案
const uploadDwgFile = async file => {
    message.info("正在上傳圖形,請稍候", 2);
    let res = await svc.uploadMap(file); // 上傳地圖
    // 輸入圖id
    let mapid = prompt("請輸入圖名稱ID", res.mapid);
    res.mapid = mapid;
    res.mapopenway = vjmap.MapOpenWay.GeomRender; // 幾何渲染,記憶體渲染用vjmap.MapOpenWay.Memory
    res.isVector = false; // 使用柵格瓦片
    res.style = vjmap.openMapDarkStyle(); // 深色樣式,淺色用openMapDarkStyle
    message.info("正在打開圖形,請稍候,第一次打開時根據圖的大小可能需要幾十秒至幾分鐘不等", 5);
    let data = https://www.cnblogs.com/vjmap/archive/2022/10/16/await svc.openMap(res); // 打開地圖
    if (data.error) {
        message.error(data.error)
        return;
    }
    openMap(data);
}

Openlayers中切換CAD圖層

olswitchlayer.gif

// 切換圖層
const switchLayer = async layers => {
    let res = await svc.cmdSwitchLayers(layers); // 呼叫唯杰服務切換圖層,回傳圖層id {layerid: "xxxx"}
    let source = layer.getSource();
    // 重新設定新的唯杰地圖服務提供的cad的柵格瓦片服務地址
    source.setUrl(svc.rasterTileUrl());
    // 重繪
    source.refresh();
}

Openlayers中切換CAD圖形

olswitchmap.gif


const switchToMapId = async (mapId)=> {
    let res = await svc.openMap({
        mapid: mapId, // 地圖ID
        mapopenway: vjmap.MapOpenWay.GeomRender, // 以幾何資料渲染方式打開
        style: vjmap.openMapDarkStyle() // div為深色背景顏色時,這里也傳深色背景樣式
    })
    if (res.error) {
        // 如果打開出錯
        message.error(res.error)
        return;
    }
// 獲取地圖范圍
    let mapBounds = vjmap.GeoBounds.fromString(res.bounds);

//自定義投影引數
    let cadProjection = new ol.proj.Projection({
        // extent用于確定縮放級別
        extent: mapBounds.toArray(),
        units: 'm'
    });
// 設定每級的解析度
    let resolutions= [];
    for(let i = 0; i < 25; i++) {
        resolutions.push(mapBounds.width() / (512 * Math.pow(2, i - 1)))
    }
// 增加自定義的cad的坐標系
    ol.proj.addProjection(cadProjection);

// 重新創建openlayer的地圖物件
    map = new ol.Map({
        target: createNewMapDivId(), // div的id
        view: new ol.View({
            center: mapBounds.center().toArray(),  // 地圖中心點
            projection: cadProjection, // 剛自定義的cad的坐標系
            resolutions:resolutions, // 解析度
            zoom: 2 // 初始縮放級別
        })
    });

// 增加一個瓦片圖層
    let layer = new ol.layer.Tile({
        // 增加一個瓦片資料源
        source: new ol.source.TileImage({
            url: svc.rasterTileUrl() // 唯杰地圖服務提供的cad的柵格瓦片服務地址
        })
    });
// 在地圖中增加上面的瓦片圖層
    map.addLayer(layer);

    map.on('click', (e) => message.info({content: `您點擊的坐標為: ${JSON.stringify(e.coordinate)}`, key: "info", duration: 3}));
}

Openlayers中深色淺色切換主題

image-20221016210550215

let curIsDarkTheme = true;
const switchToDarkTheme = async () => {
    if (curIsDarkTheme) return;
    curIsDarkTheme = true;
    document.body.style.background = "#022B4F"; // 背景色改為深色
    await updateStyle(curIsDarkTheme)
}

const switchToLightTheme = async () => {
    if (!curIsDarkTheme) return;
    curIsDarkTheme = false;
    document.body.style.backgroundImage = "linear-gradient(rgba(255, 255, 255, 1), rgba(233,255,255, 1), rgba(233,255,255, 1))"
    await updateStyle(curIsDarkTheme)
}

const updateStyle = async (isDarkTheme) => {
    style.backcolor = isDarkTheme ? 0 : 0xFFFFFF;//深色為黑色,淺色為白色
    let res = await svc.cmdUpdateStyle(style);
    let source = layer.getSource();
    // 重新設定新的唯杰地圖服務提供的cad的柵格瓦片服務地址
    source.setUrl(svc.rasterTileUrl());
    // 重繪
    source.refresh();
}

Openlayers中自定義CAD地圖樣式

通過修改CAD地圖后臺樣式資料自定義地圖

olcustommapstyle.gif


// 更改樣式
const expressionList = [] ;// 運算式陣列
const updateStyle = async (style) => {
    let res = await svc.cmdUpdateStyle({
        name: "customStyle2",
        backcolor: 0,
        expression: expressionList.join("\n"),
        ...style
    });
    let source = layer.getSource();
    // 重新設定新的唯杰地圖服務提供的cad的柵格瓦片服務地址
    source.setUrl(svc.rasterTileUrl());
    // 重繪
    source.refresh();
}

// 運算式語法和變數請參考
// 服務端條件查詢和運算式查詢 https://vjmap.com/guide/svrStyleVar.html
// 服務端渲染運算式語法 https://vjmap.com/guide/expr.html

// 修改顏色  紅color.r, 綠color.g, 藍color.b, 透明度color.a,如果輸入了級別的話,表示此級別及以上的設定
const modifyColor = (color, zoom) => {
    let result = "";
    let z = Number.isInteger(zoom) ? `[${zoom + 1}]` : '';
    if ("r" in color) result += `gOutColorRed${z}:=${color.r};`;
    if ("g" in color) result += `gOutColorGreen${z}:=${color.g};`;
    if ("b" in color) result += `gOutColorBlue${z}:=${color.b};`;
    if ("a" in color) result += `gOutColorAlpha${z}:=${color.a};`;
    return result;
}

Openlayers中對CAD圖處理組合

對多個cad圖進行圖層開關裁剪旋轉縮放處理后合并成一個新的cad圖

image-20221016210950391


// 組合成新的圖,將sys_world圖進行一定的處理后,再與sys_hello進行合成,生成新的地圖檔案名
let rsp = await svc.composeNewMap([
    {
        mapid: "sys_world", // 地圖id
        // 下面的引數可以根據實際需要來設定,可以對圖層,范圍,坐標轉換來進行處理
        layers: ["經緯度標注","COUNTRY"], // 要顯示的圖層名稱串列
        //clipbounds: [10201.981489534268, 9040.030491346213, 26501.267379,  4445.465999], // 要顯示的范圍
        //fourParameter: [0,0,1,0] // 對地圖進行四引數轉換計算
    },
    {
        mapid: "sys_hello"
    }
])
if (!rsp.status) {
    message.error(rsp.error)
}
// 回傳結果為
/*
{
    "fileid": "pec9c5f73f1d",
    "mapdependencies": "sys_world||sys_hello",
    "mapfrom": "sys_world&&v1&&&&0&&&&&&&&&&00A0&&10||sys_hello&&v1&&&&0&&&&&&&&&&&&2",
    "status": true
}
 */

Openlayers中查詢圖中所有文字并繪制邊框

olfindtextdrawbounds.gif


// 物體型別ID和名稱映射
const { entTypeIdMap } = await svc.getConstData();
const getTypeNameById = name => {
    for(let id in entTypeIdMap) {
        if (entTypeIdMap[id] == name) {
            return id
        }
    }
}
const queryTextAndDrawBounds = async () => {
    let queryTextEntTypeId = getTypeNameById("AcDbText"); // 單行文字
    let queryMTextEntTypeId = getTypeNameById("AcDbMText"); // 多行文字
    let queryAttDefEntTypeId = getTypeNameById("AcDbAttributeDefinition"); // 屬性定義文字
    let queryAttEntTypeId = getTypeNameById("AcDbAttribute"); // 屬性文字
    let query = await svc.conditionQueryFeature({
        condition: `name='${queryTextEntTypeId}' or name='${queryMTextEntTypeId}' or name='${queryAttDefEntTypeId}' or name='${queryAttEntTypeId}'`, // 只需要寫sql陳述句where后面的條件內容,欄位內容請參考檔案"服務端條件查詢和運算式查詢"
        fields: "",
        limit: 100000 //設定很大,相當于把所有的圓都查出來,不傳的話,默認只能取100條
    }, pt => {
        // 查詢到的每個點進行坐標處理回呼
        return mapPrj.fromMercator(pt);// 轉成cad的坐標
    })
    if (query.error) {
        message.error(query.error)
    } else {
        message.info(`查詢到符合的記數條數:${query.recordCount}`)

        if (query.recordCount > 0) {
            let features = [];
            for(var i = 0; i < query.recordCount; i++) {
                let bounds = vjmap.getEnvelopBounds(query.result[i].envelop, mapPrj);
                let clr = vjmap.entColorToHtmlColor(query.result[i].color); // 物體顏色轉html顏色(

                features.push({
                    type: "Feature",
                    properties: {
                        name: "objectid:" + query.result[i].objectid,
                        color: clr
                    },
                    geometry: {
                        'type': 'Polygon',
                        'coordinates': [
                            bounds.toPointArray(),
                        ],
                    }
                })
            }

            if (!vectorSource) {
                // 如果之前沒有高亮矢量圖層
                addHighLightLayer();
            }
            vectorSource.clear();
            let geojsonObject = {
                'type': 'FeatureCollection',
                'features': features
            }
            // 修改矢量資料源資料
            vectorSource.addFeatures( new ol.format.GeoJSON().readFeatures(geojsonObject, {dataProjection: cadProjection}))
        }
    }
}

Openlayers中圖形繪制

image-20221016211331840


const source = new ol.source.Vector({wrapX: false});

const vector = new ol.layer.Vector({
    source: source,
});

map.addLayer(vector);

let draw; // global so we can remove it later
function addInteraction(value) {
    map.removeInteraction(draw);
    if (value !== 'None') {
        draw = new ol.interaction.Draw({
            source: source,
            type: value,
        });
        map.addInteraction(draw);
    }
}

addInteraction('Point');

Openlayers中CAD圖疊加互聯網地圖[CAD為底圖]

olwebCad.gif


// 增加高德地圖底圖
let gdlayer;
const addGaodeMap = async (isRoadway) => {
    const tileUrl = svc.webMapUrl({
        tileCrs: "gcj02",
        tileUrl:  isRoadway ? [
                "https://webrd0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}"
            ] :
            /* 如果用影像 */
            [
                "https://webst0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=6&x={x}&y={y}&z={z}",
                "https://webst0{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}"
            ],
        tileSize: 256,
        tileRetina: 1,
        tileMaxZoom: 18,
        tileShards: "1,2,3,4",
        tileToken: "",
        tileFlipY: false,
        mapbounds: res.bounds,
        srs: "EPSG:4527",// 可通過前兩位獲取 vjmap.transform.getEpsgParam(vjmap.transform.EpsgCrsTypes.CGCS2000, 39).epsg
        // 因為sys_cad2000這個圖只有6位,沒有帶系,需要在坐標轉換前平移下帶系  https://blog.csdn.net/thinkpang/article/details/124172626
        fourParameterBefore: "39000000,0,1,0"
    })


    // 增加一個瓦片圖層
    gdlayer = new ol.layer.Tile({
        // 增加一個瓦片資料源
        source: new ol.source.TileImage({
            url: tileUrl
        })
    });
    gdlayer.setZIndex(-1);
// 在地圖中增加上面的瓦片圖層
    map.addLayer(gdlayer);


    // cad坐標與高德坐標相互轉換示例
    let webCo = await cad2webCoordinate(center, false); // cad轉高德
    let cadCo = await web2cadCoordinate(webCo, false); // 高德轉cad
    console.log(center, webCo, cadCo)
}

Openlayers中互聯網地圖自動疊加CAD圖[互聯網圖為底圖]

image-20221016211820059


let cadEpsg = "EPSG:4544";// cad圖的espg代號
// 增加cad的wms圖層
let wmsUrl = svc.wmsTileUrl({
    mapid: mapId, // 地圖id
    layers: layer, // 圖層名稱
    bbox: '', // bbox這里不需要
    srs: "EPSG:3857", //
    crs: cadEpsg
})
function getQueryStringArgs(url) {
    let theRequest = {};
    let idx = url.indexOf("?");
    if (idx != -1) {
        let str = url.substr(idx + 1);
        let strs = str.split("&");
        for (let i = 0; i < strs.length; i++) {
            let items = strs[i].split("=");
            theRequest[items[0]] = items[1];
        }
    }
    return theRequest;
}

let mapBounds = vjmap.GeoBounds.fromString(res.bounds);
// cad圖坐標轉web wgs84坐標
const cadToWebCoordinate = async point => {
    let co = await svc.cmdTransform(cadEpsg, "EPSG:4326", point);
    return co[0]
}
// cad轉wgs84經緯度
let boundsMin = await cadToWebCoordinate(mapBounds.min);
let boundsMax = await cadToWebCoordinate(mapBounds.max);
// wgs84經緯度轉墨卡托
boundsMin = vjmap.Projection.lngLat2Mercator(boundsMin);
boundsMax = vjmap.Projection.lngLat2Mercator(boundsMax);

// 在openlayer中增加wms圖層
map.addLayer(new ol.layer.Tile({
    // 范圍
    extent: [boundsMin[0], boundsMin[1], boundsMax[0], boundsMax[1]],
    source: new ol.source.TileWMS({
        url: wmsUrl.substr(0, wmsUrl.indexOf("?")),
        params: {...getQueryStringArgs(wmsUrl),'TILED': true}
    }),
}))

Openlayers中互聯網地圖公共點疊加CAD圖[互聯網圖為底圖]

olCadFourparam.gif


// cad上面的點坐標
let cadPoints = [
    vjmap.geoPoint([587464448.8435847, 3104003685.208651,]),
    vjmap.geoPoint([587761927.7224838, 3104005967.655292]),
    vjmap.geoPoint([587463688.0280377, 3103796743.3798513]),
    vjmap.geoPoint([587760406.0913897, 3103793700.1176634])
];

// 在互聯網圖上面拾取的與上面的點一一對應的坐標(wgs84坐標)
let webPoints = [
    vjmap.geoPoint([116.48476281710168, 39.96200739703454]),
    vjmap.geoPoint([116.48746772021137, 39.96022062215167]),
    vjmap.geoPoint([116.48585059441585, 39.9588451134361]),
    vjmap.geoPoint([116.48317418949145, 39.960515760972356])
]
// 通過坐標引數求出四引數
let epsg3857Points = webPoints.map(w => vjmap.geoPoint(vjmap.Projection.lngLat2Mercator(w)));
let param = vjmap.coordTransfromGetFourParamter(epsg3857Points, cadPoints , false); // 這里考慮旋轉
let fourparam = [param.dx, param.dy, param.scale, param.rotate]

// wms圖層地址
const getCadWmsUrl = (transparent) => {
    let wmsUrl = svc.wmsTileUrl({
        mapid: mapId, // 地圖id
        layers: layer, // 圖層名稱
        bbox: '', // bbox這里不需要
        fourParameter: fourparam,
        transparent: transparent,
        backgroundColor: 'rgba(240, 255, 255)' // 不透明時有效
    })
    return wmsUrl
}

let mapBounds = vjmap.GeoBounds.fromString(res.bounds);
let cadPrj = new vjmap.GeoProjection(mapBounds);


// cad圖坐標轉3857坐標
const cadToWebCoordinate = point => {
    // 再呼叫四引數反算求出web的坐標
    return vjmap.coordTransfromByInvFourParamter(vjmap.geoPoint(point), param)
}
// 3857轉cad圖坐標
const webToCadCoordinate = point => {
    return vjmap.coordTransfromByFourParamter(vjmap.geoPoint(point), param)
}

let wmsLayer;
const addWmsLayer = async (transparent)=> {
    removeWmsLayer();
    let wmsUrl = getCadWmsUrl(transparent);
    wmsLayer = new ol.layer.Tile({
        // 范圍
        extent: bounds.toArray(),
        source: new ol.source.TileWMS({
            url: wmsUrl.substr(0, wmsUrl.indexOf("?")),
            params: {...getQueryStringArgs(wmsUrl),'TILED': true}
        }),
    });
    // 在openlayer中增加wms圖層
    map.addLayer(wmsLayer);
}

最后

可點擊 https://vjmap.com/demo/#/demo/map/openlayers/01olraster 在線體驗上面功能

如果需要用openlayers來加載CAD圖進行開發,請參考示例 https://vjmap.com/demo/#/demo/map/openlayers/01olraster

如果需要用leaflet來加載CAD圖進行開發,請參考示例 https://vjmap.com/demo/#/demo/map/leaflet/01leafletraster

如果需要用maptalks來加載CAD圖進行開發,請參考示例 https://vjmap.com/demo/#/demo/map/maptalks/01maptalksraster

如何基于vue3來開發openlayers應用,可查看此開源代碼 https://github.com/MelihAltintas/vue3-openlayers

如何基于vue2來開發openlayers應用,可查看此開源代碼 https://github.com/ghettovoice/vuelayers

轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/515111.html

標籤:其他

上一篇:一款純 JS 實作的輕量化圖片編輯器

下一篇:作為類模板的成員的正確語法

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • IEEE1588PTP在數字化變電站時鐘同步方面的應用

    IEEE1588ptp在數字化變電站時鐘同步方面的應用 京準電子科技官微——ahjzsz 一、電力系統時間同步基本概況 隨著對IEC 61850標準研究的不斷深入,國內外學者提出基于IEC61850通信標準體系建設數字化變電站的發展思路。數字化變電站與常規變電站的顯著區別在于程序層傳統的電流/電壓互 ......

    uj5u.com 2020-09-10 03:51:52 more
  • HTTP request smuggling CL.TE

    CL.TE 簡介 前端通過Content-Length處理請求,通過反向代理或者負載均衡將請求轉發到后端,后端Transfer-Encoding優先級較高,以TE處理請求造成安全問題。 檢測 發送如下資料包 POST / HTTP/1.1 Host: ac391f7e1e9af821806e890 ......

    uj5u.com 2020-09-10 03:52:11 more
  • 網路滲透資料大全單——漏洞庫篇

    網路滲透資料大全單——漏洞庫篇漏洞庫 NVD ——美國國家漏洞庫 →http://nvd.nist.gov/。 CERT ——美國國家應急回應中心 →https://www.us-cert.gov/ OSVDB ——開源漏洞庫 →http://osvdb.org Bugtraq ——賽門鐵克 →ht ......

    uj5u.com 2020-09-10 03:52:15 more
  • 京準講述NTP時鐘服務器應用及原理

    京準講述NTP時鐘服務器應用及原理京準講述NTP時鐘服務器應用及原理 安徽京準電子科技官微——ahjzsz 北斗授時原理 授時是指接識訓通過某種方式獲得本地時間與北斗標準時間的鐘差,然后調整本地時鐘使時差控制在一定的精度范圍內。 衛星導航系統通常由三部分組成:導航授時衛星、地面檢測校正維護系統和用戶 ......

    uj5u.com 2020-09-10 03:52:25 more
  • 利用北斗衛星系統設計NTP網路時間服務器

    利用北斗衛星系統設計NTP網路時間服務器 利用北斗衛星系統設計NTP網路時間服務器 安徽京準電子科技官微——ahjzsz 概述 NTP網路時間服務器是一款支持NTP和SNTP網路時間同步協議,高精度、大容量、高品質的高科技時鐘產品。 NTP網路時間服務器設備采用冗余架構設計,高精度時鐘直接來源于北斗 ......

    uj5u.com 2020-09-10 03:52:35 more
  • 詳細解讀電力系統各種對時方式

    詳細解讀電力系統各種對時方式 詳細解讀電力系統各種對時方式 安徽京準電子科技官微——ahjzsz,更多資料請添加VX 衛星同步時鐘是我京準公司開發研制的應用衛星授時時技術的標準時間顯示和發送的裝置,該裝置以M國全球定位系統(GLOBAL POSITIONING SYSTEM,縮寫為GPS)或者我國北 ......

    uj5u.com 2020-09-10 03:52:45 more
  • 如何保證外包團隊接入企業內網安全

    不管企業規模的大小,只要企業想省錢,那么企業的某些服務就一定會采用外包的形式,然而看似美好又經濟的策略,其實也有不好的一面。下面我通過安全的角度來聊聊使用外包團的安全隱患問題。 先看看什么服務會使用外包的,最常見的就是話務/客服這種需要大量重復性、無技術性的服務,或者是一些銷售外包、特殊的職能外包等 ......

    uj5u.com 2020-09-10 03:52:57 more
  • PHP漏洞之【整型數字型SQL注入】

    0x01 什么是SQL注入 SQL是一種注入攻擊,通過前端帶入后端資料庫進行惡意的SQL陳述句查詢。 0x02 SQL整型注入原理 SQL注入一般發生在動態網站URL地址里,當然也會發生在其它地發,如登錄框等等也會存在注入,只要是和資料庫打交道的地方都有可能存在。 如這里http://192.168. ......

    uj5u.com 2020-09-10 03:55:40 more
  • [GXYCTF2019]禁止套娃

    git泄露獲取原始碼 使用GET傳參,引數為exp 經過三層過濾執行 第一層過濾偽協議,第二層過濾帶引數的函式,第三層過濾一些函式 preg_replace('/[a-z,_]+\((?R)?\)/', NULL, $_GET['exp'] (?R)參考當前正則運算式,相當于匹配函式里的引數 因此傳遞 ......

    uj5u.com 2020-09-10 03:56:07 more
  • 等保2.0實施流程

    流程 結論 ......

    uj5u.com 2020-09-10 03:56:16 more
最新发布
  • 使用Django Rest framework搭建Blog

    在前面的Blog例子中我們使用的是GraphQL, 雖然GraphQL的使用處于上升趨勢,但是Rest API還是使用的更廣泛一些. 所以還是決定回到傳統的rest api framework上來, Django rest framework的官網上給了一個很好用的QuickStart, 我參考Qu ......

    uj5u.com 2023-04-20 08:17:54 more
  • 記錄-new Date() 我忍你很久了!

    這里給大家分享我在網上總結出來的一些知識,希望對大家有所幫助 大家平時在開發的時候有沒被new Date()折磨過?就是它的諸多怪異的設定讓你每每用的時候,都可能不小心踩坑。造成程式意外出錯,卻一下子找不到問題出處,那叫一個煩透了…… 下面,我就列舉它的“四宗罪”及應用思考 可惡的四宗罪 1. Sa ......

    uj5u.com 2023-04-20 08:17:47 more
  • 使用Vue.js實作文字跑馬燈效果

    實作文字跑馬燈效果,首先用到 substring()截取 和 setInterval計時器 clearInterval()清除計時器 效果如下: 實作代碼如下: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta ......

    uj5u.com 2023-04-20 08:12:31 more
  • JavaScript 運算子

    JavaScript 運算子/運算子 在 JavaScript 中,有一些運算子可以使代碼更簡潔、易讀和高效。以下是一些常見的運算子: 1、可選鏈運算子(optional chaining operator) ?.是可選鏈運算子(optional chaining operator)。?. 可選鏈操 ......

    uj5u.com 2023-04-20 08:02:25 more
  • CSS—相對單位rem

    一、概述 rem是一個相對長度單位,它的單位長度取決于根標簽html的字體尺寸。rem即root em的意思,中文翻譯為根em。瀏覽器的文本尺寸一般默認為16px,即默認情況下: 1rem = 16px rem布局原理:根據CSS媒體查詢功能,更改根標簽的字體尺寸,實作rem單位隨螢屏尺寸的變化,如 ......

    uj5u.com 2023-04-20 08:02:21 more
  • 我的第一個NPM包:panghu-planebattle-esm(胖虎飛機大戰)使用說明

    好家伙,我的包終于開發完啦 歡迎使用胖虎的飛機大戰包!! 為你的主頁添加色彩 這是一個有趣的網頁小游戲包,使用canvas和js開發 使用ES6模塊化開發 效果圖如下: (覺得圖片太sb的可以自己改) 代碼已開源!! Git: https://gitee.com/tang-and-han-dynas ......

    uj5u.com 2023-04-20 08:01:50 more
  • 如何在 vue3 中使用 jsx/tsx?

    我們都知道,通常情況下我們使用 vue 大多都是用的 SFC(Signle File Component)單檔案組件模式,即一個組件就是一個檔案,但其實 Vue 也是支持使用 JSX 來撰寫組件的。這里不討論 SFC 和 JSX 的好壞,這個仁者見仁智者見智。本篇文章旨在帶領大家快速了解和使用 Vu ......

    uj5u.com 2023-04-20 08:01:37 more
  • 【Vue2.x原始碼系列06】計算屬性computed原理

    本章目標:計算屬性是如何實作的?計算屬性快取原理以及洋蔥模型的應用?在初始化Vue實體時,我們會給每個計算屬性都創建一個對應watcher,我們稱之為計算屬性watcher ......

    uj5u.com 2023-04-20 08:01:31 more
  • http1.1與http2.0

    一、http是什么 通俗來講,http就是計算機通過網路進行通信的規則,是一個基于請求與回應,無狀態的,應用層協議。常用于TCP/IP協議傳輸資料。目前任何終端之間任何一種通信方式都必須按Http協議進行,否則無法連接。tcp(三次握手,四次揮手)。 請求與回應:客戶端請求、服務端回應資料。 無狀態 ......

    uj5u.com 2023-04-20 08:01:10 more
  • http1.1與http2.0

    一、http是什么 通俗來講,http就是計算機通過網路進行通信的規則,是一個基于請求與回應,無狀態的,應用層協議。常用于TCP/IP協議傳輸資料。目前任何終端之間任何一種通信方式都必須按Http協議進行,否則無法連接。tcp(三次握手,四次揮手)。 請求與回應:客戶端請求、服務端回應資料。 無狀態 ......

    uj5u.com 2023-04-20 08:00:32 more