ArcGIS MapView BackgroundGrid behavior in Java and .NET

859
2
Jump to solution
10-15-2019 12:18 AM
FuzailSiddiqui
New Contributor III

I am working on a desktop application and moving from ASP.NET WPF to JavaFX. The application uses ArcGIS SDK to display a MapView which contains a map object in which i add a FeatureLayer which is a shape file (having countries) saved on my system to use offline. Hence i want this application to function properly without internet connectivity. Due to this, i want to customize the MapView and apply colors to it.

In .NET, i simply set MapView.BackgroundGrid to remove grid lines from the MapView and then set it's color to blue to indicate the seas. Then i use the shape FeatureLayer and apply Renderer to it which adds light brown color to the layer's country shapes to indicate lands on the map. The code in .NET goes like this:

        mapView.BackgroundGrid = new BackgroundGrid(Color.LightBlue, Color.White, 0, 1.1f);        string shapeFilePath = "path-to-shape-file";        ShapefileFeatureTable myShapefile = await ShapefileFeatureTable.OpenAsync(shapeFilePath);        FeatureLayer newFeatureLayer = new FeatureLayer(myShapefile)        {            Renderer = new SimpleRenderer()                    { Symbol = new SimpleFillSymbol() { Color = Color.SandyBrown } }        };        mapView.Map = new Map(new Basemap(newFeatureLayer));

This results as:

Now when i follow the same procedure in java, with this code:

        mapView = new MapView();        map = new ArcGISMap();        mapView.setMap(map);         mapView.setBackgroundGrid(new BackgroundGrid(hexLightBlue, hexWhite, 1, 1.1f));         String shapeFilePath = "path-to-shape-file"                ShapefileFeatureTable myShapeFile = new ShapefileFeatureTable(shapeFilePath);        newFeatureLayer = new FeatureLayer(myShapeFile);         mapView.getMap().getOperationalLayers().add(newFeatureLayer);

It results in:

Both implementations are similar. Setting color on BackgroundGrid seems to have a different effect in .NET and Java. It seems fine in .NET but in Java the lands are colored blue instead of the background which doesn't look normal. What am i doing wrong here? How do i get the same results in Java?

0 Kudos
1 Solution

Accepted Solutions
FuzailSiddiqui
New Contributor III

While troubleshooting the issue with a fellow developer, it turned out that the MapView's BackgroundGrid takes color in ARGB format while i was passing an RGB color value, hence not specifying the opacity (alpha).

View solution in original post

0 Kudos
2 Replies
FuzailSiddiqui
New Contributor III

While troubleshooting the issue with a fellow developer, it turned out that the MapView's BackgroundGrid takes color in ARGB format while i was passing an RGB color value, hence not specifying the opacity (alpha).

0 Kudos
sandeeppatil
New Contributor

hi,

I will give you the custumize application as per the need.i am freelancer working on gis server

0 Kudos