我想知道是否可以更改形状的属性 z 索引?诺基亚地图API

I would like to know if is possible change the property z index of the shapes? Nokia maps API

本文关键字:索引 属性 诺基亚 API 地图 是否 想知道      更新时间:2023-09-26

我想知道是否可以更改形状的z-index属性?

我正在圆形上方制作路线,但路线仍然落后。

我能做什么?

您可以通过更改 Polyline 的 zIndex 属性来执行此操作,就像所有 MapObject 一样,Polyline 派生自 Object 是定义 zIndex 的地方。

如果你有这样的折线:

var points = [
new nokia.maps.geo.Coordinate(50.2, 8.57),
        new nokia.maps.geo.Coordinate(50.1299, 8.5680),
        new nokia.maps.geo.Coordinate(50.0969, 8.4829),
        new nokia.maps.geo.Coordinate(50.0819, 8.4856),
        new nokia.maps.geo.Coordinate(50.0555, 8.4479),
        new nokia.maps.geo.Coordinate(50.02, 8.43)
    ];
// Purple polyline
poly = new nokia.maps.map.Polyline(
    points,
    {   
        pen: {
            strokeColor: "#22CA", 
            lineWidth: 5
        }
    }
);

以及像这样的任何地形(例如多边形):

gon = new nokia.maps.map.Polygon(
    [
        new nokia.maps.geo.Coordinate(50.2001, 8.6381),
        new nokia.maps.geo.Coordinate(50.2190, 8.5474),
        new nokia.maps.geo.Coordinate(50.2001, 8.5337),
        new nokia.maps.geo.Coordinate(50.1799, 8.4774),
        new nokia.maps.geo.Coordinate(50.1693, 8.4664),
        new nokia.maps.geo.Coordinate(50.1522, 8.4657),
        new nokia.maps.geo.Coordinate(50.1205, 8.5310),
        new nokia.maps.geo.Coordinate(50.1363, 8.5879),
        new nokia.maps.geo.Coordinate(50.1882, 8.6168)
    ],
    {
        pen: { strokeColor: "#000", lineWidth: 1 },
        brush: { color: "#C22A" }
    }
);

然后,首先放置在地图上的对象将位于后面。默认情况下,这两个对象的 zIndex 均为零。如果按如下所示增加 zIndex

poly.set("zIndex", 1)

然后它将移动到所有具有默认 zIndex 的对象之上