Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NominatimTask #1890

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
904f2b7
'#1740 Clears and sync selection on map when table selection is cleared.
patrickdalla Jun 29, 2023
bd6bd2a
Merge remote-tracking branch 'origin/master' into DelayMapUpdateWhenV…
patrickdalla Jun 29, 2023
50ad2c5
Accumulates checked event to be applyed when map is shown.
patrickdalla Jun 30, 2023
b6b6f9d
Updates checked marker icon when checked stated change on map update.
patrickdalla Jun 30, 2023
8ff6120
- Postpone checkbox sync to map update method, that is called when maps
patrickdalla Jul 3, 2023
127494e
Apply acumulated checked items before update.
patrickdalla Jul 5, 2023
8667fec
Creates an interface to make BookmarksController visible to iped-geo and
patrickdalla Jul 5, 2023
272e36a
Calls doTableSelection only if ctrl is not pressed.
patrickdalla Jul 5, 2023
ba0efaa
Removes unused method.
patrickdalla Jul 5, 2023
4a34f47
Converts shift and ctrl modifiers together to MouseEvent.
patrickdalla Jul 5, 2023
9f9a979
Adds shift and ctrl modifiers information to be passed to Java event
patrickdalla Jul 5, 2023
52662e3
Uses IBookmarkController to verify and apply checked items info only on
patrickdalla Jul 5, 2023
4bc0844
Resets flag that indicates that some checkbox is updating as its effect
patrickdalla Jul 5, 2023
93342e5
Filter only geo referenced items to be passed via javascript check
patrickdalla Jul 5, 2023
aa97bc3
Removing the async promise implementation.
patrickdalla Jul 5, 2023
a55be09
Uses RoaringBitmap to cache and filter only georeferenced items.
patrickdalla Jul 5, 2023
3ae5c93
Add roaring bitmap dependency
patrickdalla Jul 5, 2023
967fbd9
'#1487 First version of nominating task that queries a configured
patrickdalla Jul 10, 2023
4c72734
'#1487 Add metadata for country, state, city and suburb information.
patrickdalla Sep 19, 2023
2774ced
Revert "'#1487 Add metadata for country, state, city and suburb infor…
patrickdalla Sep 19, 2023
4189c3d
'#1487 Call nominatim query asynchronously in a future object and
patrickdalla Sep 19, 2023
d155ba2
'#1487 Tree model implementation to show nominatim info in a panel.
patrickdalla Sep 19, 2023
b2d9bd6
'#1487 Skip null value returned when some exception is thrown by the
patrickdalla Sep 19, 2023
b2d92b5
'#1487 Process some nominatim responses that uses the term "town"
patrickdalla Sep 19, 2023
8cc2f77
'#1487 Reset internal variable that controls when to data is ready to be
patrickdalla Sep 20, 2023
b49ca1d
'#1487 Creation of class to represent the nominatim panel.
patrickdalla Sep 20, 2023
4e8a61b
App nominatim panel instalation.
patrickdalla Sep 21, 2023
38350bf
Revert "App nominatim panel instalation."
patrickdalla Sep 21, 2023
832a113
'#1487 Adds tree node to represent the georeferenced items that the
patrickdalla Sep 21, 2023
14c024a
'#1487 Reloads nominatim tree model after case data is loaded.
patrickdalla Sep 21, 2023
6dcec30
'#Removes nominatim panel installation as it will be improved and
patrickdalla Sep 21, 2023
ebdcd51
'#1487 Improve exception treatment to save the error in geojson
patrickdalla Sep 21, 2023
d36fc22
'#1487 Better null pointer treatment for erroneous or incomplete
patrickdalla Sep 21, 2023
0f1045f
'#1487 Corrects error treatment to use the correct initialization
patrickdalla Sep 21, 2023
700952a
'#1487 Error treatmento to when there is no
patrickdalla Sep 21, 2023
627927b
'#1487 removes nominatim GUI panel installation as it will be improved
patrickdalla Sep 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions iped-api/src/main/java/iped/localization/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public static ResourceBundle getExternalBundle(String bundleName, Locale locale)
} catch (URISyntaxException e1) {
e1.printStackTrace();
}
file = new File(System.getProperty("user.dir")+ "/iped/localization");
if (file != null && !file.exists()) {
File baseFile = new File(System.getProperty("user.dir"));
do {
Expand Down
8 changes: 6 additions & 2 deletions iped-app/resources/config/IPEDConfig.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ enableAudioTranscription = false
# Enables carving. "addUnallocated" must be enabled to unallocated area be searched.
# By default carving runs on almost every item in the case.
# File types to be searched and retrieved can be set in file "conf/CarvingConfig.txt"
enableCarving = false
enableCarving = true

# Enables carving that retrieves known files from the LED base, based on the beginning (64K) of the file.
# It's necessary to enable "addUnallocated" and to configure "hashesDB" (with LED hashes data imported).
Expand Down Expand Up @@ -133,6 +133,10 @@ enableVideoThumbs = true
# Advanced configurations can be found at conf/DocThumbsConfig.txt.
enableDocThumbs = false

# Enables nominatim address resolving of geo locations
# Server settings can be modified in file "conf/NominatimConfig.txt"
enableNominatimLocationResolving = true

# Enables HTML report generation on automatic extractions or from selected items.
# Generation settings can be modified in file "conf/HTMLReportConfig.txt"
enableHTMLReport = true
enableHTMLReport = true
14 changes: 14 additions & 0 deletions iped-app/resources/config/conf/NominatimConfig.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#host name of the nominatim server
hostName=10.65.6.2

#port of the nominatim server service
hostPort=8080

#protocol of the nominatim server service (http or https)
protocol=http

#protocol of the nominatim server service (http or https)
connectionPoolSize=auto

#Query to be passed via URL to test if service is available at task init
serviceTestUrlQuery=/?country=brazil
2 changes: 1 addition & 1 deletion iped-app/resources/config/conf/TaskInstaller.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
<task class="iped.engine.task.PhotoDNALookup"></task>
<task script="NSFWNudityDetectTask.py"></task>
<task script="FaceRecognitionTask.py"></task>
<task script="SearchHardwareWallets.py"></task>

<!--Carving must be installed before IndexTask because it sets hasChildren property in parent items-->
<task class="iped.engine.task.carver.LedCarveTask"></task>
Expand All @@ -49,6 +48,7 @@

<task class="iped.engine.task.FragmentLargeBinaryTask"></task>
<task class="iped.engine.task.EntropyTask"></task>
<task class="iped.geo.nominatim.NominatimTask"></task>
<task class="iped.engine.task.MinIOTask"></task>
<task class="iped.engine.task.index.ElasticSearchIndexTask"></task>
<task class="iped.engine.task.index.IndexTask"></task>
Expand Down
15 changes: 9 additions & 6 deletions iped-app/src/main/java/iped/app/ui/BookmarksController.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@

import iped.engine.data.Bookmarks;
import iped.utils.LocalizedFormat;
import iped.viewers.bookmarks.IBookmarksController;

public class BookmarksController {
public class BookmarksController implements IBookmarksController {

public static final String HISTORY_DIV = Messages.getString("BookmarksController.HistoryDelimiter"); //$NON-NLS-1$

private static BookmarksController instance;

private static JFileChooser fileChooser;
private static SearchStateFilter filter;

Expand All @@ -38,9 +37,13 @@ public boolean isUpdatingHistory() {
}

public static BookmarksController get() {
if (instance == null)
instance = new BookmarksController();
return instance;
IBookmarksController ibc = IBookmarksController.get();
if ((ibc == null) || !(ibc instanceof BookmarksController)) {
ibc = new BookmarksController();
IBookmarksController.registerBookmarksController(ibc);
}

return (BookmarksController) ibc;
}

public void setMultiSetting(boolean value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public void processTaskConfig(Path resource) throws IOException {
processProperties(properties);
}

abstract void processProperties(UTF8Properties properties);
public abstract void processProperties(UTF8Properties properties);

}
6 changes: 6 additions & 0 deletions iped-geo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@
<artifactId>gt-geojson</artifactId>
<version>19.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.roaringbitmap/RoaringBitmap -->
<dependency>
<groupId>org.roaringbitmap</groupId>
<artifactId>RoaringBitmap</artifactId>
<version>0.9.45</version>
</dependency>

</dependencies>

Expand Down
34 changes: 34 additions & 0 deletions iped-geo/src/main/java/iped/geo/AbstractMapCanvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ abstract public class AbstractMapCanvas extends Canvas {
*
*/
private static final long serialVersionUID = 1L;
protected static final String ALLMARKERS_TAG = "allmarkers";
MapSelectionListener mapSelectionListener = null;
protected MarkerEventListener markerEventListener = null;
protected MarkerCheckBoxListener markerCheckBoxListener = null;
Expand All @@ -30,6 +31,7 @@ abstract public class AbstractMapCanvas extends Canvas {

protected ArrayList<Runnable> onLoadRunnables = new ArrayList<Runnable>();

protected HashMap<String, Boolean> checkMapToApply;
protected HashMap<String, Boolean> selectionMapToApply;
protected String leadSelectionToApply;
protected Runnable saveRunnable;
Expand Down Expand Up @@ -81,6 +83,11 @@ public Runnable getSaveRunnable() {
return saveRunnable;
}

public void clearSelection() {
this.selectionMapToApply = new HashMap<String, Boolean>();
this.selectionMapToApply.put(AbstractMapCanvas.ALLMARKERS_TAG, false);
}

public void sendSelection(final HashMap<String, Boolean> selectionMap) {
if (this.selectionMapToApply == null) {
this.selectionMapToApply = new HashMap<String, Boolean>();
Expand All @@ -93,6 +100,23 @@ public void sendSelection(final HashMap<String, Boolean> selectionMap) {
}
}

public void clearCheck() {
this.checkMapToApply = new HashMap<String, Boolean>();
this.checkMapToApply.put(AbstractMapCanvas.ALLMARKERS_TAG, false);
}

public void sendCheck(final HashMap<String, Boolean> checkedMap) {
if (this.checkMapToApply == null) {
this.checkMapToApply = new HashMap<String, Boolean>();
}

String[] marks = new String[checkedMap.keySet().size()];
marks = checkedMap.keySet().toArray(marks);
for (int i = 0; i < marks.length; i++) {
this.checkMapToApply.put(marks[i], checkedMap.get(marks[i]));
}
}

public void setOnChangeTileServer(ActionListener actionListener) {
this.onChangeTileServer = actionListener;
}
Expand Down Expand Up @@ -134,6 +158,16 @@ public void setLeadSelectionToApply(String leadSelectionToApply) {
this.leadSelectionToApply = leadSelectionToApply;
}

public void executeOnLoadRunnables() {
if (onLoadRunnables.size() > 0) {
for (Iterator iterator = onLoadRunnables.iterator(); iterator.hasNext();) {
Runnable runnable = (Runnable) iterator.next();
runnable.run();
}
onLoadRunnables.clear();
}
}

public void runAfterLoad(Runnable run) {
onLoadRunnables.add(run);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public void onClicked(String mid, MouseEvent e) {
boolean olddesabilitaTemp = mapViewer.desabilitaTemp;
mapViewer.desabilitaTemp = true;
if (e != null) {
AppMapMarkerEventListener.doTableSelection(t, pos, e.isShiftDown());
if (!((e.getModifiersEx() & MouseEvent.CTRL_DOWN_MASK) == MouseEvent.CTRL_DOWN_MASK)) {
AppMapMarkerEventListener.doTableSelection(t, pos, e.isShiftDown());
}
}

IItemId[] siblings = mapaPanel.getTrackSiblings();
Expand Down
55 changes: 52 additions & 3 deletions iped-geo/src/main/java/iped/geo/impl/AppMapPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.CancellationException;
import java.util.function.Consumer;
Expand All @@ -25,6 +26,7 @@
import javax.swing.event.TableModelListener;

import org.apache.lucene.document.Document;
import org.roaringbitmap.RoaringBitmap;

import iped.data.IItemId;
import iped.engine.config.ConfigurationManager;
Expand All @@ -45,7 +47,7 @@
* Classe que controla a integração da classe App com a classe MapaCanvas
*/

public class AppMapPanel extends JPanel implements Consumer<KMLResult> {
public class AppMapPanel extends JPanel implements Consumer<Object[]> {

/**
*
Expand Down Expand Up @@ -79,9 +81,11 @@ public enum MapLoadState {

MapLoadState loadState = MapLoadState.NOTLOADED;
private GetResultsJSWorker mapLoadWorker;
private RoaringBitmap[] geoReferencedBitmap;

public AppMapPanel(IMultiSearchResultProvider resultsProvider, GUIProvider guiProvider) {
this.resultsProvider = resultsProvider;
this.resultsTable = resultsProvider.getResultsTable();
this.guiProvider = guiProvider;
this.setLayout(new BorderLayout());

Expand Down Expand Up @@ -256,14 +260,21 @@ synchronized public void updateMap() {
if (loadState == MapLoadState.NOTLOADED) {
loadState = MapLoadState.LOADING;
mapLoadWorker = new GetResultsJSWorker(resultsProvider, cols, gpsProgressBar, browserCanvas, this);

mapLoadWorker.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if ("state".equals(evt.getPropertyName()) && (SwingWorker.StateValue.DONE.equals(evt.getNewValue()))) {
if ("state".equals(evt.getPropertyName())
&& (SwingWorker.StateValue.DONE.equals(evt.getNewValue()))) {
loadState = MapLoadState.LOADED;

syncSelectedItems();
mapViewer.applyCheckedItems();
browserCanvas.update();
}
}
});

mapLoadWorker.execute();
} else if (loadState == MapLoadState.LOADING) {
if (lastPropertyChangeListener != null) {
Expand Down Expand Up @@ -292,8 +303,40 @@ public void propertyChange(PropertyChangeEvent evt) {
}
}

private void syncSelectedItems() {
int[] selected = resultsTable.getSelectedRows();
IMultiSearchResult results = resultsProvider.getResults();
HashMap<String, Boolean> selecoes = new HashMap<String, Boolean>();
for (int i = 0; i < selected.length; i++) {
int rowModel = resultsTable.convertRowIndexToModel(selected[i]);
IItemId item = results.getItem(rowModel);

List<Integer> subitems = kmlResult.getGPSItems().get(item);
if (subitems == null) {
String gid = "marker_" + item.getSourceId() + "_" + item.getId(); //$NON-NLS-1$ //$NON-NLS-2$
selecoes.put(gid, true);
} else {
for (Integer subitem : subitems) {
String gid = "marker_" + item.getSourceId() + "_" + item.getId() + "_" //$NON-NLS-1$ //$NON-NLS-2$
+ subitem;
selecoes.put(gid, true);
}
}
}

mapViewer.updateMapLeadCursor();

browserCanvas.sendSelection(selecoes);
}

@Override
public void accept(KMLResult kmlResult) {
public void accept(Object[] result) {
KMLResult kmlResult = (KMLResult) result[0];

if (result[1] != null) {
geoReferencedBitmap = (RoaringBitmap[]) result[1];
}

if (kmlResult.getItemsWithGPS() == 0) {
gpsProgressBar.setValue(0);
gpsProgressBar.setString(Messages.getString("KMLResult.NoGPSItem"));
Expand All @@ -302,10 +345,12 @@ public void accept(KMLResult kmlResult) {
}
this.kmlResult = kmlResult;
browserCanvas.setKML(kmlResult.getKML());

mapaDesatualizado = false;
}

public void update() {
mapViewer.applyCheckedItems();
browserCanvas.update();
mapaDesatualizado = false;
}
Expand Down Expand Up @@ -497,4 +542,8 @@ public String[] getSelectedRegexFeatures() {
return null;
}

public boolean hasItem(IItemId item) {
return geoReferencedBitmap[item.getSourceId()].contains(item.getId());
}

}
Loading
Loading