Skip to content

Commit

Permalink
Merge branch 'DelayMapUpdateWhenVisible'
Browse files Browse the repository at this point in the history
  • Loading branch information
lfcnassif committed Jun 21, 2023
2 parents 2a0642c + 0dda1af commit 4245aae
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 5 deletions.
9 changes: 9 additions & 0 deletions iped-app/src/main/java/iped/app/ui/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,15 @@ public IIPEDSearcher createNewSearch(String query) {
return csf.getSearcher();
}

@Override
public IIPEDSearcher createNewSearch(String query, boolean applyFilters) {
CaseSearcherFilter csf = new CaseSearcherFilter(query);
if (applyFilters) {
csf.applyUIQueryFilters();
}
return csf.getSearcher();
}

@Override
public IIPEDSearcher createNewSearch(String query, String[] sortFields) {
IIPEDSearcher searcher = null;
Expand Down
16 changes: 13 additions & 3 deletions iped-geo/src/main/java/iped/geo/impl/MapViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

import bibliothek.gui.dock.common.DefaultSingleCDockable;
import iped.data.IItemId;
import iped.geo.js.GetResultsJSWorker;
import iped.geo.localization.Messages;
import iped.properties.BasicProps;
import iped.viewers.api.GUIProvider;
import iped.viewers.api.IMultiSearchResultProvider;
import iped.viewers.api.ResultSetViewer;
Expand Down Expand Up @@ -63,6 +61,10 @@ public JPanel getPanel() {

@Override
public void redraw() {
if (unprocessedChange != null) {
tableChanged(unprocessedChange);
}

if (mapaPanel.browserCanvas.isLoaded()) {
if (!updatingCheckbox) {
mapaPanel.updateMap();
Expand All @@ -71,6 +73,7 @@ public void redraw() {
}

boolean internaltableChanged = false;
private TableModelEvent unprocessedChange;

@Override
public void checkAll(boolean value) {
Expand All @@ -88,7 +91,14 @@ public void run() {

@Override
public void tableChanged(TableModelEvent e) {
if (e.getFirstRow() == -1 && e.getLastRow() == -1) {
if (!mapaPanel.isShowing()) {
unprocessedChange = e;
return;
}

unprocessedChange = null;

if ((e.getFirstRow() == -1 && e.getLastRow() == -1)) {
/**/
return;
}
Expand Down
2 changes: 1 addition & 1 deletion iped-geo/src/main/java/iped/geo/js/GetResultsJSWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ protected KMLResult createAllPlacemarks() throws Exception {

String query = ExtraProperties.LOCATIONS.replace(":", "\\:") + ":*";

IIPEDSearcher searcher = app.createNewSearch(query);
IIPEDSearcher searcher = app.createNewSearch(query, false);
IMultiSearchResult multiResult = searcher.multiSearch();

IMultiSearchResult results = multiResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,10 @@ public void run() {
}

public String getMainHtml() throws IOException {
this.url = JMapOptionsPane.getSavedTilesSourceURL();
if(this.url == null) {
setUrl(JMapOptionsPane.getSavedTilesSourceURL());
}

String html = IOUtils.toString(getClass().getResourceAsStream("main.html"), "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
String js = IOUtils.toString(getClass().getResourceAsStream("L.KML.js"), "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
String markerclusterjs = IOUtils.toString(getClass().getResourceAsStream("leaflet.markercluster.js"), //$NON-NLS-1$
Expand Down Expand Up @@ -488,6 +491,7 @@ public void run() {

@Override
public boolean setTileServerUrl(String url) {
setUrl(url);
if (url.contains("googleapis") && url.contains("key") && !url.substring(url.indexOf("key=")).equals(lastGoogleApiKey)) {
lastGoogleApiKey = url.substring(url.indexOf("key="));
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public interface IMultiSearchResultProvider {
*/
IIPEDSearcher createNewSearch(String query);

/*
* creates an independent search from the current search result
*/
IIPEDSearcher createNewSearch(String query, boolean applyFilters);

/*
* creates an independent search from the current search result
*/
Expand Down

0 comments on commit 4245aae

Please sign in to comment.