CodenameOne MapContainer 缩放级别

CodenameOne MapContainer Zoom Level

我正在使用 MapContainer(cn1lib)。所以在 android 设备低分辨率下缩放效果很好。但在 android 高分辨率设备中,缩放效果不佳。放大保持远。我附加了一个放大到最大的屏幕,这是一个错误还是我错了?

SCREENSHOT

GUI-DESIGN

public class StateMachine 扩展了 StateMachineBase {

MapContainer mapContainer;

public StateMachine(String resFile) {
    super(resFile);
    // do not modify, write code in initVars and initialize class members there,
    // the constructor might be invoked too late due to race conditions that might occur
}

/**
 * this method should be used to initialize variables instead of the
 * constructor/class scope to avoid race conditions
 */
protected void initVars(Resources res) {
}

@Override
protected void beforeShow(Form f) {
    try {

        this.mapContainer.setShowMyLocation(true);
        this.mapContainer.zoom(new Coord(20.640086, -103.432207), 17);
        this.mapContainer.setCameraPosition(new Coord(20.640086, -103.432207));
        this.mapContainer.addMarker(
                EncodedImage.createFromImage(fetchResourceFile().getImage("pin.png"), false),
                new Coord(20.640086, -103.432207),
                "Hi marker", "Optional long description",
                new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        Dialog.show("Marker Clicked!", "You clicked the marker", "OK", null);
                    }
                }
        );


        this.mapContainer.addPointerDraggedListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent evt) {
                mapContainer.clearMapLayers();
                mapContainer.addMarker(EncodedImage.createFromImage(fetchResourceFile().getImage("pin.png"), false), mapContainer.getCameraPosition(), "Hi marker", "Optional long description", new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        Dialog.show("Marker Clicked!", "You clicked the marker", "OK", null);
                    }
                });

            }
        });

    } catch (Exception ex) {
        ex.printStackTrace();
    }
    super.beforeShow(f); //To change body of generated methods, choose Tools | Templates.
}

@Override
protected Component createComponentInstance(String componentType, Class cls) {
    if (cls == MapComponent.class) {    
        this.mapContainer = new MapContainer();
        return this.mapContainer;
    }
    return super.createComponentInstance(componentType, cls); //To change body of generated methods, choose Tools | Templates.
}

}

那是 MapComponent 不是本地地图,因此它使用旧的开放街道地图支持和相对简单的地图渲染,即使在设备上也是如此。我们支持未在 GUI 生成器中公开的 native google maps,但您可以通过代码添加它。

这会将实际的本机 GUI 嵌入到位,尽管在模拟器上看起来一样,但在设备上看起来和感觉都更好。