Mars3d采用ellipsoid球实现模拟地球旋转效果

news2024/11/24 22:48:11

1.Mars3d采用ellipsoid球实现模拟地球旋转效果

2.开始自选装之后,模型一直闪烁

http://mars3d.cn/editor-vue.html?id=graphic/entity/ellipsoid

3.相关代码:

import * as mars3d from "mars3d"

export let map // mars3d.Map三维地图对象
export let graphicLayer // 矢量图层对象
export const eventTarget = new mars3d.BaseClass()

export const mapOptions = {
  scene: {
    center: { lat: 30.606438, lng: 116.329605, alt: 53280, heading: 0, pitch: -60 }
  }
}
/**
 * 初始化地图业务,生命周期钩子函数(必须)
 * 框架在地图初始化完成后自动调用该函数
 * @param {mars3d.Map} mapInstance 地图对象
 * @returns {void} 无
 */
export function onMounted(mapInstance) {
  map = mapInstance // 记录map

  // 创建矢量数据图层
  graphicLayer = new mars3d.layer.GraphicLayer()
  map.addLayer(graphicLayer)

  // 在layer上绑定监听事件
  graphicLayer.on(mars3d.EventType.click, function (event) {
    console.log("监听layer,单击了矢量对象", event)
  })
  bindLayerPopup() // 在图层上绑定popup,对所有加到这个图层的矢量数据都生效
  bindLayerContextMenu() // 在图层绑定右键菜单,对所有加到这个图层的矢量数据都生效

  // 加一些演示数据
//   addDemoGraphic1(graphicLayer)
  addDemoGraphic2(graphicLayer)
//   addDemoGraphic3(graphicLayer)
//   addDemoGraphic3b(graphicLayer)
//   addDemoGraphic4(graphicLayer)
//   addDemoGraphic5(graphicLayer)
//   addDemoGraphic6(graphicLayer)
//   addDemoGraphic7(graphicLayer)
//   addDemoGraphic8(graphicLayer)
//   addDemoGraphic9(graphicLayer)
//   addDemoGraphic10(graphicLayer)
//   addDemoGraphic11(graphicLayer)
//   addDemoGraphic12(graphicLayer)
//   addDemoGraphic13(graphicLayer)
//   addDemoGraphic14(graphicLayer)
}

/**
 * 释放当前地图业务的生命周期函数
 * @returns {void} 无
 */
export function onUnmounted() {
  map = null

  graphicLayer.remove()
  graphicLayer = null
}

//
function addDemoGraphic1(graphicLayer) {
  const graphic = new mars3d.graphic.EllipsoidEntity({
    position: [116.1, 31.0, 1000],
    style: {
      radii: new Cesium.Cartesian3(1000.0, 1000.0, 1500.0),
      color: "#00ff00",
      opacity: 0.5,

      label: { text: "鼠标移入会高亮", pixelOffsetY: -30 },
      // 高亮时的样式(默认为鼠标移入,也可以指定type:'click'单击高亮),构造后也可以openHighlight、closeHighlight方法来手动调用
      highlight: {
        opacity: 0.9
      }
    },
    attr: { remark: "示例1" }
  })
  graphicLayer.addGraphic(graphic) // 还可以另外一种写法: graphic.addTo(graphicLayer)

  // 演示个性化处理graphic
  initGraphicManager(graphic)
}
// 也可以在单个Graphic上做个性化管理及绑定操作
function initGraphicManager(graphic) {
  // 3.在graphic上绑定监听事件
  // graphic.on(mars3d.EventType.click, function (event) {
  //   console.log("监听graphic,单击了矢量对象", event)
  // })
  // 绑定Tooltip
  // graphic.bindTooltip('我是graphic上绑定的Tooltip') //.openTooltip()

  // 绑定Popup
  const inthtml = `<table style="width: auto;">
            <tr>
              <th scope="col" colspan="2" style="text-align:center;font-size:15px;">我是graphic上绑定的Popup </th>
            </tr>
            <tr>
              <td>提示:</td>
              <td>这只是测试信息,可以任意html</td>
            </tr>
          </table>`
  graphic.bindPopup(inthtml).openPopup()

  // 绑定右键菜单
  graphic.bindContextMenu([
    {
      text: "删除对象[graphic绑定的]",
      icon: "fa fa-trash-o",
      callback: (e) => {
        const graphic = e.graphic
        if (graphic) {
          graphic.remove()
        }
      }
    }
  ])

  // 测试 颜色闪烁
  if (graphic.startFlicker) {
    graphic.startFlicker({
      time: 20, // 闪烁时长(秒)
      maxAlpha: 0.5,
      color: Cesium.Color.YELLOW,
      onEnd: function () {
        // 结束后回调
      }
    })
  }
}

//
function addDemoGraphic2(graphicLayer) {
  const graphic = new mars3d.graphic.EllipsoidEntity({
    position: new mars3d.LngLatPoint(116.2, 31.0, 1000),
    style: {
      radii: new Cesium.Cartesian3(1000.0, 1000.0, 1000.0),
      color: Cesium.Color.RED.withAlpha(0.5),
      outline: true,
      outlineColor: "rgba(255,255,255,0.5)"
    },
    attr: { remark: "示例2" }
  })
  graphicLayer.addGraphic(graphic) // 还可以另外一种写法: graphic.addTo(graphicLayer)
  // 设置自转动画
    map.viewer.clock.onTick.addEventListener(function(clock) {
    var time = clock.currentTime;
    var multiplier = 1; // 时间流速倍数,可以根据需要调整

    // 计算地球的旋转角度
    var angle = window.Cesium.Math.TWO_PI * multiplier * time.secondsOfDay / 86400;

    // 设置EllipsoidEntity的旋转角度
    // const a = window.Cesium.Quaternion.fromAxisAngle(window.Cesium.Cartesian3.UNIT_Z, angle);
    graphic.entity.orientation.setValue(window.Cesium.Quaternion.fromAxisAngle(window.Cesium.Cartesian3.UNIT_Z, angle));
    // graphic.orientation = window.Cesium.Quaternion.fromAxisAngle(window.Cesium.Cartesian3.UNIT_Z, angle);
    });
}

function addDemoGraphic3(graphicLayer) {
  const graphic = new mars3d.graphic.EllipsoidEntity({
    position: new mars3d.LngLatPoint(116.307258, 30.999546, 1239.2),
    style: {
      radii: new Cesium.Cartesian3(2000.0, 2000.0, 2000.0),
      maximumConeDegree: 90,
      materialType: mars3d.MaterialType.EllipsoidElectric,
      materialOptions: {
        color: Cesium.Color.GREEN,
        speed: 5.0
      }
    },
    attr: { remark: "示例3" }
  })
  graphicLayer.addGraphic(graphic) // 还可以另外一种写法: graphic.addTo(graphicLayer)
}

function addDemoGraphic3b(graphicLayer) {
  const graphic = new mars3d.graphic.EllipsoidEntity({
    position: new mars3d.LngLatPoint(116.303345, 31.087028, 452.2),
    style: {
      radii: new Cesium.Cartesian3(2000.0, 2000.0, 2000.0),
      maximumConeDegree: 90,
      materialType: mars3d.MaterialType.EllipsoidWave,
      materialOptions: {
        color: "#00ffff",
        speed: 5.0
      }
    }
  })
  graphicLayer.addGraphic(graphic) // 还可以另外一种写法: graphic.addTo(graphicLayer)
}

//
function addDemoGraphic4(graphicLayer) {
  const graphic = new mars3d.graphic.EllipsoidEntity({
    position: [116.4, 31.0, 1000],
    style: {
      radii: new Cesium.Cartesian3(2500.0, 2500.0, 2500.0),
      innerRadii: new Cesium.Cartesian3(10.0, 10.0, 10.0),
      minimumClockDegree: -15.0,
      maximumClockDegree: 15.0,
      minimumConeDegree: 75.0,
      maximumConeDegree: 105.0,
      pitch: 30,
      color: "#f33349",
      opacity: 0.9,
      outline: true,
      outlineColor: "rgba(255,255,255,0.5)",
      label: {
        text: "我是原始的",
        font_size: 18,
        color: "#ffffff",
        pixelOffsetY: -10,
        distanceDisplayCondition: true,
        distanceDisplayCondition_far: 500000,
        distanceDisplayCondition_near: 0
      }
    },
    attr: { remark: "示例4" }
  })
  graphicLayer.addGraphic(graphic)

  // graphic转geojson
  const geojson = graphic.toGeoJSON()
  console.log("转换后的geojson", geojson)
  addGeoJson(geojson, graphicLayer)
}

// 添加单个geojson为graphic,多个直接用graphicLayer.loadGeoJSON
function addGeoJson(geojson, graphicLayer) {
  const graphicCopy = mars3d.Util.geoJsonToGraphics(geojson)[0]
  delete graphicCopy.attr
  // 新的坐标
  graphicCopy.position = [116.5, 31.0, 1000]
  graphicCopy.style.label = graphicCopy.style.label || {}
  graphicCopy.style.label.text = "我是转换后生成的"
  graphicLayer.addGraphic(graphicCopy)
}

// 2圈平面扇形
function addDemoGraphic5(graphicLayer) {
  const outerRadius = 5000.0
  const innerRadius = 1000

  const graphic = new mars3d.graphic.EllipsoidEntity({
    position: [116.1, 30.9, 1000],
    style: {
      radii: new Cesium.Cartesian3(outerRadius, outerRadius, outerRadius),
      innerRadii: new Cesium.Cartesian3(innerRadius, innerRadius, innerRadius),
      minimumClockDegree: -20.0,
      maximumClockDegree: 20.0,
      minimumConeDegree: 90,
      maximumConeDegree: 90,
      color: "rgba(255,255,0,0.2)",
      outline: true,
      outlineColor: "rgba(255,255,255,0.5)"
    },
    attr: { remark: "示例5" }
  })
  graphicLayer.addGraphic(graphic) // 还可以另外一种写法: graphic.addTo(graphicLayer)
}

// 半圆顶球体
function addDemoGraphic6(graphicLayer) {
  const graphic = new mars3d.graphic.EllipsoidEntity({
    position: new mars3d.LngLatPoint(116.2, 30.9, 1000),
    style: {
      radii: new Cesium.Cartesian3(2000.0, 2000.0, 2000.0),
      maximumConeDegree: 90,
      color: Cesium.Color.BLUE.withAlpha(0.3),
      outline: true,
      outlineColor: "rgba(255,255,255,0.5)"
    },
    attr: { remark: "示例6" }
  })
  graphicLayer.addGraphic(graphic) // 还可以另外一种写法: graphic.addTo(graphicLayer)
}

// 含内半径 半圆顶球体
function addDemoGraphic7(graphicLayer) {
  const graphic = new mars3d.graphic.EllipsoidEntity({
    position: new mars3d.LngLatPoint(116.3, 30.9, 1000),
    style: {
      radii: new Cesium.Cartesian3(2500.0, 2000.0, 1500.0),
      innerRadii: new Cesium.Cartesian3(1000.0, 800.0, 600.0),
      maximumConeDegree: 90,
      color: Cesium.Color.RED.withAlpha(0.3),
      outline: true,
      outlineColor: "rgba(255,255,255,0.5)"
    },
    attr: { remark: "示例7" }
  })
  graphicLayer.addGraphic(graphic) // 还可以另外一种写法: graphic.addTo(graphicLayer)
}

// 被切开的含内半径 半圆顶球体
function addDemoGraphic8(graphicLayer) {
  const graphic = new mars3d.graphic.EllipsoidEntity({
    position: new mars3d.LngLatPoint(116.4, 30.9, 1000),
    style: {
      radii: new Cesium.Cartesian3(2000.0, 2000.0, 2000.0),
      innerRadii: new Cesium.Cartesian3(1000.0, 1000.0, 1000.0),
      minimumConeDegree: 20.0,
      maximumConeDegree: 90,
      color: Cesium.Color.YELLOW.withAlpha(0.3),
      outline: true,
      outlineColor: "rgba(255,255,255,0.5)"
    },
    attr: { remark: "示例8" }
  })
  graphicLayer.addGraphic(graphic) // 还可以另外一种写法: graphic.addTo(graphicLayer)
}

// 顶部和底部切出的桶形体
function addDemoGraphic9(graphicLayer) {
  const graphic = new mars3d.graphic.EllipsoidEntity({
    position: new mars3d.LngLatPoint(116.5, 30.9, 1000),
    style: {
      radii: new Cesium.Cartesian3(2000.0, 2000.0, 2000.0),
      innerRadii: new Cesium.Cartesian3(1000.0, 1000.0, 1000.0),
      minimumConeDegree: 60.0,
      maximumConeDegree: 140.0,
      color: "rgba(31,254,230,0.3)",
      outline: true,
      outlineColor: "rgba(255,255,255,0.5)"
    },
    attr: { remark: "示例9" }
  })
  graphicLayer.addGraphic(graphic)
}

// 碗行体
function addDemoGraphic10(graphicLayer) {
  const graphic = new mars3d.graphic.EllipsoidEntity({
    position: new mars3d.LngLatPoint(116.1, 30.8, 1000),
    style: {
      radii: new Cesium.Cartesian3(2000.0, 2000.0, 2000.0),
      innerRadii: new Cesium.Cartesian3(1800.0, 1800.0, 1800.0),
      minimumConeDegree: 110.0,
      color: "rgba(149,228,12,0.3)",
      outline: true,
      outlineColor: "rgba(255,255,255,0.5)"
    },
    attr: { remark: "示例10" }
  })
  graphicLayer.addGraphic(graphic)
}

// 时钟开孔
function addDemoGraphic11(graphicLayer) {
  const graphic = new mars3d.graphic.EllipsoidEntity({
    position: new mars3d.LngLatPoint(116.2, 30.8, 1000),
    style: {
      radii: new Cesium.Cartesian3(2000.0, 2000.0, 2000.0),
      innerRadii: new Cesium.Cartesian3(1500.0, 1500.0, 1500.0),
      minimumClockDegree: -90.0,
      maximumClockDegree: 180.0,
      minimumConeDegree: 20.0,
      maximumConeDegree: 70.0,
      color: "rgba(149,228,12,0.3)",
      outline: true,
      outlineColor: "rgba(255,255,255,0.5)"
    },
    attr: { remark: "示例11" }
  })
  graphicLayer.addGraphic(graphic)
}

// 局部圆顶
function addDemoGraphic12(graphicLayer) {
  const graphic = new mars3d.graphic.EllipsoidEntity({
    position: new mars3d.LngLatPoint(116.3, 30.8, 1000),
    style: {
      radii: new Cesium.Cartesian3(2000.0, 2000.0, 2000.0),
      minimumClockDegree: -90.0,
      maximumClockDegree: 180.0,
      maximumConeDegree: 90.0,
      color: "rgba(242,250,25,0.3)",
      outline: true,
      outlineColor: "rgba(255,255,255,0.5)"
    },
    attr: { remark: "示例12" }
  })
  graphicLayer.addGraphic(graphic)
}

// 部分椭圆体
function addDemoGraphic13(graphicLayer) {
  const graphic = new mars3d.graphic.EllipsoidEntity({
    position: new mars3d.LngLatPoint(116.4, 30.8, 1000),
    style: {
      radii: new Cesium.Cartesian3(3000.0, 3000.0, 3000.0),
      innerRadii: new Cesium.Cartesian3(700.0, 700.0, 700.0),
      minimumClockDegree: 180.0,
      maximumClockDegree: 400.0,
      maximumConeDegree: 90.0,
      color: "rgba(247,154,44,0.3)",
      outline: true,
      outlineColor: "rgba(255,255,255,0.5)"
    },
    attr: { remark: "示例13" }
  })
  graphicLayer.addGraphic(graphic)
}

// 土星综合对象
function addDemoGraphic14(graphicLayer) {
  const position = new mars3d.LngLatPoint(116.5, 30.8, 1000)
  const graphic = new mars3d.graphic.EllipsoidEntity({
    name: "土星",
    position: position,
    style: {
      radii: new Cesium.Cartesian3(2000.0, 2000.0, 2000.0),
      color: new Cesium.Color(0.95, 0.82, 0.49)
    },
    attr: { remark: "示例14" }
  })
  graphicLayer.addGraphic(graphic)

  const graphicNei = new mars3d.graphic.EllipsoidEntity({
    name: "土星的内圈",
    position: position,
    style: {
      radii: new Cesium.Cartesian3(4000.0, 4000.0, 4000.0),
      innerRadii: new Cesium.Cartesian3(3000.0, 3000.0, 3000.0),
      minimumConeDegree: 89.8,
      maximumConeDegree: 90.2,
      color: new Cesium.Color(0.95, 0.82, 0.49, 0.5),
      heading: 30,
      pitch: 30
    }
  })
  graphicLayer.addGraphic(graphicNei)

  const graphicWai = new mars3d.graphic.EllipsoidEntity({
    name: "土星外圈",
    position: position,
    style: {
      radii: new Cesium.Cartesian3(4600.0, 4600.0, 4600.0),
      innerRadii: new Cesium.Cartesian3(4150.0, 4150.0, 4150.0),
      minimumConeDegree: 89.8,
      maximumConeDegree: 90.2,
      color: new Cesium.Color(0.95, 0.82, 0.49, 0.5),
      heading: 30,
      pitch: 30
    }
  })
  graphicLayer.addGraphic(graphicWai)
}

// 生成演示数据(测试数据量)
export function addRandomGraphicByCount(count) {
  graphicLayer.clear()
  graphicLayer.enabledEvent = false // 关闭事件,大数据addGraphic时影响加载时间

  const bbox = [116.984788, 31.625909, 117.484068, 32.021504]
  const result = mars3d.PolyUtil.getGridPoints(bbox, count, 30)
  console.log("生成的测试网格坐标", result)

  const radius = result.radius

  for (let j = 0; j < result.points.length; ++j) {
    const position = result.points[j]
    const index = j + 1

    const graphic = new mars3d.graphic.EllipsoidEntity({
      position: position,
      style: {
        radii: new Cesium.Cartesian3(radius, radius, radius),
        color: Cesium.Color.fromRandom({ alpha: 0.6 })
      },
      attr: { index: index }
    })
    graphicLayer.addGraphic(graphic)
  }

  graphicLayer.enabledEvent = true // 恢复事件
  return result.points.length
}

// 开始绘制
export function startDrawGraphic() {
  graphicLayer.startDraw({
    type: "ellipsoid",
    style: {
      color: "rgba(0,255,255,0.6)"
    }
  })
}

// 在图层绑定Popup弹窗
export function bindLayerPopup() {
  graphicLayer.bindPopup(function (event) {
    const attr = event.graphic.attr || {}
    attr["类型"] = event.graphic.type
    attr["来源"] = "我是layer上绑定的Popup"
    attr["备注"] = "我支持鼠标交互"

    return mars3d.Util.getTemplateHtml({ title: "矢量图层", template: "all", attr: attr })
  })
}

// 绑定右键菜单
export function bindLayerContextMenu() {
  graphicLayer.bindContextMenu([
    {
      text: "开始编辑对象",
      icon: "fa fa-edit",
      show: function (e) {
        const graphic = e.graphic
        if (!graphic || !graphic.hasEdit) {
          return false
        }
        return !graphic.isEditing
      },
      callback: (e) => {
        const graphic = e.graphic
        if (!graphic) {
          return false
        }
        if (graphic) {
          graphicLayer.startEditing(graphic)
        }
      }
    },
    {
      text: "停止编辑对象",
      icon: "fa fa-edit",
      show: function (e) {
        const graphic = e.graphic
        if (!graphic || !graphic.hasEdit) {
          return false
        }
        return graphic.isEditing
      },
      callback: (e) => {
        const graphic = e.graphic
        if (!graphic) {
          return false
        }
        if (graphic) {
          graphic.stopEditing()
        }
      }
    },
    {
      text: "删除对象",
      icon: "fa fa-trash-o",
      show: (event) => {
        const graphic = event.graphic
        if (!graphic || graphic.isDestroy) {
          return false
        } else {
          return true
        }
      },
      callback: (e) => {
        const graphic = e.graphic
        if (!graphic) {
          return
        }
        const parent = graphic.parent // 右击是编辑点时
        graphicLayer.removeGraphic(graphic)
        if (parent) {
          graphicLayer.removeGraphic(parent)
        }
      }
    }
  ])
}

 

4.采用属性机制即可实现球体模拟地球旋转的效果:

采用属性机制即可

 function addDemoGraphic2(graphicLayer) {
  const graphic = new mars3d.graphic.EllipsoidEntity({
    position: new mars3d.LngLatPoint(116.2, 31.0, 1000),
    style: {
      radii: new Cesium.Cartesian3(1000.0, 1000.0, 1000.0),
      color: Cesium.Color.RED.withAlpha(0.5),
      outline: true,
      outlineColor: "rgba(255,255,255,0.5)"
    },
    attr: { remark: "示例2" }
  })
  graphicLayer.addGraphic(graphic) // 还可以另外一种写法: graphic.addTo(graphicLayer)

  // 设置自转动画
  let angle
  map.on(mars3d.EventType.clockTick, function (clock) {
    angle = (Cesium.Math.TWO_PI * clock.multiplier * clock.currentTime.secondsOfDay) / 86400 // 计算旋转角度
  })
  graphic.entity.orientation = new Cesium.CallbackProperty((time) => {
    return Cesium.Quaternion.fromAxisAngle(Cesium.Cartesian3.UNIT_Z, angle)
  }, false)

}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/752332.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Linux基础服务10——虚拟化kvm

文章目录 一、基本了解二、安装kvm2.1 部署准备2.2 安装基础服务2.3 安装web管理服务 三、web界面管理3.1 添加kvm主机3.2 存储管理3.2.1 上传镜像3.2.2 扩容存储池 3.3 网络管理3.4 创建虚拟机3.5 报错处理3.5.1 Server disconnected3.5.1 文件句柄问题 一、基本了解 什么是虚…

短视频抖音seo源码矩阵系统源码开发规则

一、 技术开发文档说明 目录 一、 技术开发文档说明 1. 系统架构 2. 抖音seo排名系统模块组成 二、功能结构&#xff1a; 三、 抖音seo源码开发功能目录 四、 短视频抖音seo矩阵系统源码开发代码展示 1. 建立数据表 1. 系统架构 短视频抖音seo矩阵源码部署功能架构包含…

基于 MNN 在个人设备上流畅运行大语言模型

LLM&#xff08;大语言模型&#xff09;因其强大的语言理解能力赢得了众多用户的青睐&#xff0c;但LLM庞大规模的参数导致其部署条件苛刻&#xff1b;在网络受限&#xff0c;计算资源有限的场景下无法使用大语言模型的能力&#xff1b;低算力&#xff0c;本地化部署的问题亟待…

牧云·云原生安全平台v2.0.0正式上线,云上想不安全都难!

**前言&#xff1a;**牧云云原生安全平台是长亭牧云团队以开源社区为生态载体技术积累为驱动所打造的云原生安全平台。首创双模探针架构&#xff0c;可选用 Agentless/Agent 多种方案进行部署&#xff0c;覆盖制品、运行时、集群全流程安全&#xff0c;开箱即用、快速实施、成本…

这所双一流,我求求你不要错过!错过后悔一年!

一、学校及专业介绍 山西大学&#xff08;ShanxiUniversity&#xff09;&#xff0c;位于山西省太原市&#xff0c;是中国办学历史最悠久的高等学府之一&#xff0c;国家“双一流”建设高校。 1.1 招生情况 物理电子工程学院中,081000信息与通信工程、085402通信工程&#xf…

IIS 部署的应用禁用HTTP TRACE / TRACK方法【原理扫描】

远程Web服务器支持TRACE和/或TRACK方法。 TRACE和TRACK是用于调试Web服务器连接的HTTP方法。 直接在网站Web.config文件中进行如下操作&#xff1a;在Web.config中的<system.webServer>节点内添加以下配置即可&#xff1a; <security> <requestFiltering> &…

水果编曲软件FLStudio21.0.3.3517中文直装版2023最新百度网盘下载

水果编曲软件FLStudio21.0.3.3517中文直装版2023最新百度网盘完整下载是最好的音乐开发和制作软件也称为水果循环。它是最受欢迎的工作室&#xff0c;因为它包含了一个主要的听觉工作场所。最新水果编曲软件FLStudio21中文直装版有不同的功能&#xff0c;如它包含图形和音乐音序…

Linux 虚拟机重启远程连接超时

问题 : 虚拟机关机重启之后,本来可以连接的远程,访问超时 原因 : 为了可以访问 CentOS 虚拟机,在 /etc/sysconfig/network-scripts/ifcfg-ens33 中修改使用了network静态ip的方式,在重启后与NetWorkManager自动配置冲突,导致远程无法正常访问 处理方式 &#xff1a; 禁用…

PyTorch从零开始实现Transformer

文章目录 自注意力Transformer块编码器解码器块解码器整个Transformer参考来源全部代码&#xff08;可直接运行&#xff09; 自注意力 计算公式 代码实现 class SelfAttention(nn.Module):def __init__(self, embed_size, heads):super(SelfAttention, self).__init__()self.e…

奥特曼与钢铁侠【InsCode Stable Diffusion美图活动一期】

文章目录 简介图片生成步骤更多体验方式 简介 InsCode 是一个一站式的软件开发服务平台&#xff0c;从开发-部署-运维-运营&#xff0c;都可以在 InsCode 轻松完成。 InsCode 的 Ins 是 Inspiration&#xff0c;意思是创作、寻找有灵感的代码。 Stable Diffusion是文图生成模型…

MySQL的下载、安装和配置(图文详解)

目录 一、MySQL的4大版本 二、软件的下载 1. 下载地址 2. 打开官网&#xff0c;点击DOWNLOADS 3. 点击 MySQL Community Server 三、MySQL8.0 版本的安装 四、配置MySQL8.0 五、配置MySQL8.0 环境变量 六、MySQL5.7 版本的安装、配置 一、MySQL的4大版本 MySQL Commu…

内存泄露?腾讯工程师2个压箱底的方法和工具

导读&#xff5c;遭受内存泄露往往是令开发者头疼的问题&#xff0c;传统分析工具 gdb、Valgrind在解决内存泄露问题上效率较低。本文特别邀请到了腾讯后台开发工程师邢孟棒以 TDSQL实际生产中mysql-proxy内存泄露问题作为分析对象&#xff0c;分享其基于动态追踪技术的通用内存…

倾斜摄影三维模型数据在哪些行业或场景发挥了重要的作用?

倾斜摄影技术是一种高精度三维建模方法&#xff0c;目前已经在许多行业中获得了认可。倾斜摄影技术就是利用无人机搭载相机以不同的角度捕捉建筑物、道路等物体的外形&#xff0c;并生成高分辨率的三维模型数据。那么&#xff0c;这些数据能够应用在哪些行业或场景中呢&#xf…

智慧校园能源管控系统

智慧校园能源管控系统是一种搭载了物联网技术、大数据技术、大数据等技术性智能化能源管理方法系统&#xff0c;致力于为学校提供更高效、安全性、可信赖的能源供应管理和服务。该系统包括了校内的电力工程、水、气、暖等各类能源&#xff0c;根据对能源的实时检测、数据统计分…

最全的ubuntu20.04上安装nvidia和cuda

文章目录 一、环境要求二、查询推荐安装的驱动版本三、安装470四、查看显卡驱动是否成功五、安装对应版本的cuda 官方路径 一、环境要求 ubuntu20.04如果之前有过驱动应该先卸载 sudo apt-get --purge remove nvidia* sudo apt autoremove# 卸载cuda sudo apt-get --purge r…

Jenkins全栈体系(二)

Jenkins 第三章 Jenkins Git Maven 自动化部署配置 十、几种构建方式 快照依赖构建/Build whenever a SNAPSHOT dependency is built 当依赖的快照被构建时执行本job 触发远程构建 (例如,使用脚本) 远程调用本job的restapi时执行本job job依赖构建/Build after other proj…

【分布式应用】kafka集群、Filebeat+Kafka+ELK搭建

目录 一、kafka概述1.1为什么需要消息队列&#xff08;MQ&#xff09;1.2常见的中间1.3消息队列的优点1.4消息队列的两种模式1.5 Kafka 定义1.6 Kafka 的特性1.7kafka的系统架构 二、部署kafka集群2.1安装kafka2.2Kafka 命令行操作 三、kafka架构深入3.1kfka工作流程及文件存储…

flutter开发实战-flutter实现类似iOS的Alert提示框与sheet菜单效果

flutter开发实战-flutter实现类似iOS的Alert提示框与sheet菜单效果 在开发过程中&#xff0c;经常使用到提示框Dialog&#xff0c;与sheet&#xff0c;使用到了flutter的showDialog与showModalBottomSheet 我这里类似alert弹窗直接调用 flutter 中提供的showDialog()函数显示对…

QML语法--第二篇

链接: QML Book中文版(QML Book In Chinese) QML语言描述了用户界面元素的形状和行为。用户界面能够使用JavaScript来提供修饰&#xff0c;或者增加更加复杂的逻辑。 从QML元素的层次结构来理解是最简单的学习方式。子元素从父元素上继承了坐标系统&#xff0c;它的x,y坐标总…

社交圈..

社交圈 - 题目 - Daimayuan Online Judge 思路&#xff1a;我们能够想到&#xff0c;如果i,j是并列的&#xff0c;则l[i]与r[j]会有重合的部分&#xff0c;那么其实重合的部分越多越好&#xff0c;其实就是让l[i]与r[i]的差值越小越好&#xff0c;同时要让越…