Esri / runtime-questions

Welcome to the 2017 Esri Developer Summit and the session called, "Everything (or Anything) You Wanted to Know About the ArcGIS Runtime SDKs but Were Afraid to Ask"
12 stars 7 forks source link

Java - A feature layer will not draw on the map until the underlying featuretable is accessed by a query. #62

Closed jbessette closed 8 years ago

jbessette commented 9 years ago
    private void AddFeatureLayer(Map map)
    {
        ServiceFeatureTable vehicleTable = new ServiceFeatureTable("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Military/FeatureServer/2");     
        FeatureLayer vehicleLayer = new FeatureLayer(vehicleTable);
        map.getOperationalLayers().add(vehicleLayer);

        SimpleMarkerSymbol sms = new SimpleMarkerSymbol(new RgbColor((byte)255, (byte)0, (byte)0, (byte)255), 10,
                                        com.esri.arcgisruntime.symbology.SimpleMarkerSymbol.Style.CIRCLE);
        SimpleRenderer renderer = new SimpleRenderer(sms);
        vehicleLayer.setRenderer(renderer);

        vehicleLayer.addLoadStatusChangedListener(new LoadStatusChangedListener() {
            @Override
            public void loadStatusChanged(LoadStatusChangedEvent arg0) {
                Platform.runLater(new Runnable() {
                    @Override public void run() {
                        if (arg0.getNewLoadStatus() == LoadStatus.LOADED)
                        {
                            //THE NEXT LINE THROWS AN ERROR, BUT THE LAYER WILL NOT DRAW IF IT IS NOT PRESENT.
                            ListenableFuture<FeatureQueryResult> resultFuture = vehicleTable.queryFeaturesAsync(null); 
                        }
                    }
                });
            }
        });
    }

I cannot get a ServiceFeatureTable layer to draw unless I try to access the underlying data with a query. Calling layer.LoadAsync() does not have any affect.

willcrick commented 8 years ago

bug was fixed at beta 1.