retrieve
The administrativeUnitsFlow is triggered in many ways:
When a new Image is created: It can be triggered when an Image is created for the first time, so there is no AdministrativeUnitName. A coroutine is launched to create the AdministrativeUnitName using the coordinates extracted from the Image. If the Image has an AdministrativeUnitName, that means it was already created before. This is when the first AdministrativeUnits are created. Initially, they are created without a CartographicBoundary, so the user will see a map without any shapes drawn, but they will see a map focused on the Image where it was drawn. Each new AdministrativeUnit is created based on the information of the AdministrativeUnitName. If the AdministrativeUnit was already created, the new image is simply added to the AdministrativeUnit and its outer levels.
When a new AdministrativeUnitName is created: Each AdministrativeUnitName is received by the AdministrativeUnitNameDataSource along with the list of up to 4 CartographicBoundarys, one for each AdministrativeLevel. The method cartographicBoundariesToRetrieve filters all missing cartographic boundaries for each AdministrativeLevel, and the method retrieveOnlyNonExistentCartographicBoundariesFrom uses the cartographicBoundaryRetriever to retrieve all missing CartographicBoundarys.
When a new CartographicBoundary is created: The method feeds all existing AdministrativeUnits with their missing CartographicBoundarys so the user can now see the outlines of the AdministrativeUnits inside the map on the screen.
Return
a Flow of List of AdministrativeUnit from all AdministrativeLevels
Return
A Flow of List of AdministrativeUnit from a specific AdministrativeLevel.
Parameters
The administrative level used to filter.