小编r08*_*r08的帖子

使用 mapbox gl 和三个 js 在地图上的单个图层中渲染多个 gltf 3D 模型

我使用 mapbox gl 和来自链接的three.js 在地图上添加gltf 3D 模型

但是在单个单独的图层中添加单个 3D gltf 模型并将它们添加到地图工作正常,但是有什么方法可以在地图的单个图层中添加多个 3D gltf 模型。

地图代码:

this.modelOrigin = [148.9819, -35.3981];
this.modelOrigin2 = [148.9819, -35.4981];
this.iconImage = "https://docs.mapbox.com/mapbox-gl-js/assets/34M_17/34M_17.gltf";


//map info here
var map = new mapboxgl.Map({
  container: 'map', // container id
  style: 'mapbox://styles/mapbox/streets-v9', //stylesheet location
  center: [148.9819, -35.3981], // starting position[35.890, -75.664]
  zoom: 17.5, // starting zoom
  hash: true,
  minZoom: 0,
  maxZoom: 22,
  preserveDrawingBuffer: true,
  pitch: 60
});

var self = this;

map.on('style.load', function () {
 //adding separate 3d …
Run Code Online (Sandbox Code Playgroud)

javascript three.js mapbox-gl-js gltf

6
推荐指数
1
解决办法
1271
查看次数

Mapbox gl:鼠标悬停在图层上时更改光标指针样式

我有 10 到 15 个不同的图层,例如汽车、公共汽车、路线等。如果需要,我会在地图上动态添加这些图层,因为地图上始终不存在所有图层。

所以我在单击图层时显示信息,但我希望当我将鼠标悬停在图层上时,将鼠标指针光标样式更改为“十字准线”。

我已经在 mouseenter 事件上写了更改光标样式,但它似乎有时有效,有时即使鼠标悬停在图层上但光标样式没有改变。

第一种方式:

 map.on('mouseenter', (e: any) => {
      self.mapInstance.getCanvas().style.cursor = 'crosshair';
    });
Run Code Online (Sandbox Code Playgroud)

第二种方式:

      map.on('mouseenter',(e: any) => {         
       var features = map.queryRenderedFeatures(e.point,{ layers: ['Car',"Bus"] });
//error let's say any layer still on exist on map
        if(features.length)
         map.getCanvas().style.cursor = 'crosshair';    
            });
Run Code Online (Sandbox Code Playgroud)

我的问题

  1. 光标样式没有改变

  2. queryRenderedFeatures 上的错误,如层不存在

  3. 鼠标在悬停层上闪烁

如何在鼠标悬停在不同图层上时更改光标样式?

mapbox mapbox-gl-js

4
推荐指数
3
解决办法
3992
查看次数

此模块使用“export =”声明,并且只能在使用“allowSyntheticDefaultImports”标志时与默认导入一起使用

我在执行时遇到以下错误npm publish,但构建工作正常。

下面是运行发布包的命令。

npm run ng-packagr -p projects/core/package.json && cd dist/@app/formgenerator-core && npm publish

包.json

{
  "name": "@app/formgenerator-core",
  "version": "0.0.4",
  "description": "Angular JSON schema form generator core",
  "author": "devteam",
  "keywords": [
    "angular json schema form generator"
  ],
  "contributors": [
    "devteam@gmail.com"
  ],
  "private": false,
  "license": "UNLICENSED",
  "ngPackage": {
    "$schema": "../../node_modules/ng-packagr/package.schema.json",
    "dest": "../../dist/@app/formgenerator-core",
    "lib": {
      "entryFile": "src/public_api.ts",
      "umdModuleIds": {
        "lodash/isEqual": "lodash-es",
        "lodash/cloneDeep": "lodash-es",
        "lodash/filter": "lodash-es",
        "lodash/map": "lodash-es",
        "lodash/uniqueId": "lodash-es",
        "ajv": "ajv",
        "ajv/lib/refs/json-schema-draft-06.json": "jsonDraft6",
        "hot-formula-parser": "hot-formula-parser",
        "@app/app-virtual-keypad": "@app/app-virtual-keypad"
      }
    },
    "whitelistedNonPeerDependencies": …
Run Code Online (Sandbox Code Playgroud)

lodash angular-cli angular

2
推荐指数
2
解决办法
1244
查看次数

期望在路径 $ 中找到具有属性 ['xyz'] 的对象,但找到了 'org.json.JSONObject'。根据 JsonProvider,这不是 json 对象:

我正在使用json-pathcom.jayway.jsonpath:2.4.0`

爪哇代码:

 public static void main( String[] args )
{
       
    JSONObject jObject =new JSONObject("{\r\n  \"structure\": {\r\n    \"tables\": {\r\n      \"category\": \"vehicle\"\r\n    }\r\n  },\r\n  \"data\": {}\r\n}") ;
    Object jsonPathArray = JsonPath.read(jObject,"$.structure.tables");
 
    System.out.println(jsonPathArray);
}
Run Code Online (Sandbox Code Playgroud)

例外:

Exception in thread "main" com.jayway.jsonpath.PathNotFoundException: Expected to find an object with property ['structure'] in path $ but found 'org.json.JSONObject'. This is not a json object according to the JsonProvider: 'com.jayway.jsonpath.spi.json.JsonSmartJsonProvider'.
    at com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:71)
    at com.jayway.jsonpath.internal.path.RootPathToken.evaluate(RootPathToken.java:62)
    at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:53)
    at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:61)
    at com.jayway.jsonpath.JsonPath.read(JsonPath.java:187)
    at com.jayway.jsonpath.internal.JsonContext.read(JsonContext.java:102)
    at com.jayway.jsonpath.internal.JsonContext.read(JsonContext.java:89)
    at com.jayway.jsonpath.JsonPath.read(JsonPath.java:488) …
Run Code Online (Sandbox Code Playgroud)

java jsonpath

0
推荐指数
1
解决办法
1763
查看次数