Hi i want fade my map outside its geometry like i have done javascript api like in the link.
Query : How to create the gray area over the extent expand to 10 so that i will perform difference between geometry and the extent
Geometry difference(Geometry geometry1, Geometry geometry2)
I want to do it same in qt sdkFade back map outside of polygon
An simple solution might be to just buffer the geometry by whatever distance you want. https://developers.arcgis.com/qt/latest/qml/api-reference/qml-esri-arcgisruntime-geometryengine.html#buffer-method
Hi guys can anyone help me in this task, as it is quite intricate for me to plot gray area outside polygons and then get difference of them
You can accomplish this by adding a Polygon graphic that has a hole in it.
Here is an example where I have a multipart polygon - one part has 4 points and the other has 4 as well. The interior part goes in counter clockwise order and is shown as a hole. This is described in the REST specs a bit for ArcGIS as a whole - Geometry objects—Common Data Types | ArcGIS for Developers
MapView <SPAN class="punctuation token">{</SPAN> id<SPAN class="punctuation token">:</SPAN> mv anchors<SPAN class="punctuation token">.</SPAN>fill<SPAN class="punctuation token">:</SPAN> parent Map <SPAN class="punctuation token">{</SPAN> BasemapImagery<SPAN class="punctuation token">{</SPAN><SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> GraphicsOverlay <SPAN class="punctuation token">{</SPAN> Graphic <SPAN class="punctuation token">{</SPAN> symbol<SPAN class="punctuation token">:</SPAN> SimpleFillSymbol <SPAN class="punctuation token">{</SPAN> color<SPAN class="punctuation token">:</SPAN> Qt<SPAN class="punctuation token">.</SPAN><SPAN class="token function">rgba</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="number token">75</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> geometry<SPAN class="punctuation token">:</SPAN> Polygon <SPAN class="punctuation token">{</SPAN> json<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN><SPAN class="string token">"rings"</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">18684976.52965096</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">13174661.735383898</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">11421379.755389877</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">11822129.922245625</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">13775786.985667616</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">9517816.462824922</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">18384413.904509123</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">8215378.42054362</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">18684976.52965096</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">13174661.735383898</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">1202250.5005673468</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">3907314.1268438715</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">601125.2502836883</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">4057595.4394147918</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">651219.0211406611</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">5860971.190265823</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">1603000.667423129</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">5760783.648551878</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">1202250.5005673468</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="number token">3907314.1268438715</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"spatialReference"</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="punctuation token">{</SPAN><SPAN class="string token">"latestWkid"</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="number token">3857</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"wkid"</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="number token">102100</SPAN><SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
To keep this code concise, I just defined it in JSON, but you could use the PolygonBuilder class and add several parts to it. Each part should contain points. The order defined will be important for making it topologically sound and display as you desire
I am trying it this way and is succeed also and
want to expand graphics of overlayGray to some more km distance from my extent, can u help me how to expand it:my extent
Here in getExtentEnvelope() i counted the xmin xmax etc values manually, so the polygon appears on my whole screen. The pictures i attached below are some zoomed out images.
Component.onCompleted: { var overlaygeometry='';
// add the polygon
var rings = userMap.getpolygon;//boundaries from db
graphicsOverlay.graphics.append(createGraphic(createPolygon(rings), fillSymbol));
overlaygeometry=GeometryEngine.difference(getExtentEnvelope(), createPolygon(rings));
graphicsOverlay.graphics.append(createGraphic(overlaygeometry, overlayGray));
}//End components.loaded
SimpleFillSymbol{
id:overlayGray
style: Enums.SimpleFillSymbolStyleSolid
color: Qt.rgba(1,1,0,0.2)
}
function getExtentEnvelope(){
const sr = ArcGISRuntimeEnvironment.createObject("SpatialReference", { "wkid": 4326});
return ArcGISRuntimeEnvironment.createObject("Envelope", { xMin: xMinVal, yMin: yMinVal, xMax: xMaxVal, yMax: yMaxVal, spatialReference:sr});
} function createGraphic(geometry, symbol) {
var graphic = ArcGISRuntimeEnvironment.createObject("Graphic");
graphic.geometry = geometry;
graphic.symbol = symbol;
return graphic;
}//end createGraphic function createPolygon(ring) {
// create polygon using json
const sr = { "wkid": 4326};
var boundaryJson = {"rings":ring,"spatialReference":sr};
var boundary= ArcGISRuntimeEnvironment.createObject("Polygon", {"json": boundaryJson});
return boundary;
Lucas Danzinger Is this task still on your list, i just want help with extent expamsion to some few kms, Can u. help me for it.
No, I don't understand what you are trying to accomplish.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.