当前位置: 首页>>代码示例>>Java>>正文


Java ProgressMonitor类代码示例

本文整理汇总了Java中org.openstreetmap.josm.gui.progress.ProgressMonitor的典型用法代码示例。如果您正苦于以下问题:Java ProgressMonitor类的具体用法?Java ProgressMonitor怎么用?Java ProgressMonitor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ProgressMonitor类属于org.openstreetmap.josm.gui.progress包,在下文中一共展示了ProgressMonitor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseDataSet

import org.openstreetmap.josm.gui.progress.ProgressMonitor; //导入依赖的package包/类
@Override
public DataSet parseDataSet(InputStream in, ProgressMonitor monitor)
        throws IllegalDataException {

    IndoorFeaturesType root;
    if(isFirstType) {
        root = Marshalling.unmarshal(in);
        tempRoot = root;

        // TEST
        /*try {
            Marshalling.marshal(root, new FileOutputStream(new File("outputdiprova.igml")));
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }*/
        return IGMLConverter.convert(root);
    } else {
        return parsePesce(in, monitor);
    }
    
    
}
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:24,代码来源:PesceImporter.java

示例2: downloadIndoorGML

import org.openstreetmap.josm.gui.progress.ProgressMonitor; //导入依赖的package包/类
public Future<?> downloadIndoorGML(boolean newLayer, String url, ProgressMonitor progressMonitor) {

        //importer
//        IndoorFeaturesType root;
//        try {
//            root = Marshalling.unmarshal(new URL(url).openStream());
//        } catch (IOException e) {
//            // TODO Auto-generated catch block
//            e.printStackTrace();
//            return null;
//        }
//
//        downloadedData = IGMLConverter.convert(root);

        return Main.worker.submit(downloadTask);
        //return null;
    }
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:18,代码来源:DownloadIlocateTask.java

示例3: getDataForFile

import org.openstreetmap.josm.gui.progress.ProgressMonitor; //导入依赖的package包/类
protected DataSet getDataForFile(File f, final ProgressMonitor progressMonitor) throws FileNotFoundException, IOException, XMLStreamException, FactoryConfigurationError, JAXBException {
    Main.debug("[DownloadIlocateTask.ZippedShpReader.getDataForFile] Calling MY getDataForFile");
    if (f == null) {
        return null;
    } else if (!f.exists()) {
        Main.warn("File does not exist: " + f.getPath());
        return null;
    } else {
        Main.info("Parsing zipped shapefile " + f.getName());
        FileInputStream in = new FileInputStream(f);
        ProgressMonitor instance = null;
        if (progressMonitor != null) {
            instance = progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false);
        }
        return ShpReader.parseDataSet(in, f, null, instance);
    }
}
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:18,代码来源:DownloadIlocateTask.java

示例4: sleepAndListen

import org.openstreetmap.josm.gui.progress.ProgressMonitor; //导入依赖的package包/类
private void sleepAndListen(int retry, ProgressMonitor monitor) throws OsmTransferCanceledException {
    Main.info(tr("Waiting 10 seconds ... "));
    for (int i=0; i < 10; i++) {
        if (monitor != null) {
            monitor.setCustomText(tr("Starting retry {0} of {1} in {2} seconds ...", getMaxRetries() - retry,getMaxRetries(), 10-i));
        }
        if (cancel)
            throw new OsmTransferCanceledException("Transfer is canceled");
        try {
            Thread.sleep(1000);
        } catch (InterruptedException ex) {
            Main.warn("InterruptedException in "+getClass().getSimpleName()+" during sleep");
        }
    }
    Main.info(tr("OK - trying again."));
}
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:17,代码来源:IlocateUploadTask.java

示例5: importData

import org.openstreetmap.josm.gui.progress.ProgressMonitor; //导入依赖的package包/类
@Override
public void importData(final File file, final ProgressMonitor progressMonitor) {

    progressMonitor.beginTask(tr("Loading json file..."));
    progressMonitor.setTicksCount(2);
    Logging.info("Parsing GeoJSON: " + file.getAbsolutePath());
    try {
        final ObjectMapper mapper = new ObjectMapper();
        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        final GeoJsonObject object = mapper.readValue(file, GeoJsonObject.class);

        progressMonitor.worked(1);

        final BoundedDataSet data = new DataSetBuilder().build(object);

        final Layer layer = new GeoJsonLayer(tr("Data Layer from GeoJSON: ") + file.getName(), data);
        MainApplication.getLayerManager().addLayer(layer);
    } catch (final Exception e) {
        Logging.error("Error while reading json file!");
        Logging.error(e);
        GuiHelper.runInEDT(() -> JOptionPane.showMessageDialog(
                null, tr("Error loading geojson file {0}", file.getAbsolutePath()), tr("Error"), JOptionPane.WARNING_MESSAGE));
    } finally {
        progressMonitor.finishTask();
    }
}
 
开发者ID:JOSM,项目名称:geojson,代码行数:27,代码来源:GeoJsonFileImporter.java

示例6: closeNote

import org.openstreetmap.josm.gui.progress.ProgressMonitor; //导入依赖的package包/类
public void closeNote(Note note, String closeMessage) throws OsmTransferException {
	ProgressMonitor monitor = NullProgressMonitor.INSTANCE;
	String encodedMessage;
	try {
		encodedMessage = URLEncoder.encode(closeMessage, "UTF-8");
	} catch(UnsupportedEncodingException e) {
		e.printStackTrace();
		return;
	}
	StringBuilder urlBuilder = new StringBuilder()
		.append("notes/")
		.append(note.getId())
		.append("/close");
	if(encodedMessage != null && !encodedMessage.trim().isEmpty()) {
		urlBuilder.append("?text=");
		urlBuilder.append(encodedMessage);
	}
	
	sendRequest("POST", urlBuilder.toString(), null, monitor, true, false);
}
 
开发者ID:iandees,项目名称:josm-notes,代码行数:21,代码来源:NotesCapableOsmApi.java

示例7: reopenNote

import org.openstreetmap.josm.gui.progress.ProgressMonitor; //导入依赖的package包/类
public Note reopenNote(Note note, String reactivateMessage) throws OsmTransferException {
	ProgressMonitor monitor = NullProgressMonitor.INSTANCE;
	String encodedMessage;
	try {
		encodedMessage = URLEncoder.encode(reactivateMessage, "UTF-8");
	} catch(UnsupportedEncodingException e) {
		e.printStackTrace();
		return null;
	}
	StringBuilder urlBuilder = new StringBuilder()
		.append("notes/")
		.append(note.getId())
		.append("/reopen");
	if(encodedMessage != null && !encodedMessage.trim().isEmpty()) {
		urlBuilder.append("?text=");
		urlBuilder.append(encodedMessage);
	}

	String response = sendRequest("POST", urlBuilder.toString(), null, monitor, true, false);
	List<Note> newNote = parseNotes(response);
	if(newNote.size() != 0) {
		return newNote.get(0);
	}
	return null;
}
 
开发者ID:iandees,项目名称:josm-notes,代码行数:26,代码来源:NotesCapableOsmApi.java

示例8: createNote

import org.openstreetmap.josm.gui.progress.ProgressMonitor; //导入依赖的package包/类
public Note createNote(LatLon latlon, String text) throws OsmTransferException {
	ProgressMonitor monitor = NullProgressMonitor.INSTANCE;
	String encodedText;
	try {
		encodedText = URLEncoder.encode(text, "UTF-8");
	}
	catch(UnsupportedEncodingException e) {
		e.printStackTrace();
		return null;
	}
	String url = new StringBuilder()
		.append("notes?lat=")
		.append(latlon.lat())
		.append("&lon=")
		.append(latlon.lon())
		.append("&text=")
		.append(encodedText).toString();
	
	String response = sendRequest("POST", url, null, monitor, true, false);
	List<Note> newNote = parseNotes(response);
	if(newNote.size() != 0) {
		return newNote.get(0);
	}
	return null;
}
 
开发者ID:iandees,项目名称:josm-notes,代码行数:26,代码来源:NotesCapableOsmApi.java

示例9: AddCommentToNote

import org.openstreetmap.josm.gui.progress.ProgressMonitor; //导入依赖的package包/类
public Note AddCommentToNote(Note note, String comment) throws OsmTransferException {
	if(comment == null || comment.trim().isEmpty()) {
		return note;
	}
	ProgressMonitor monitor = NullProgressMonitor.INSTANCE;
	String encodedComment;
	try {
		encodedComment = URLEncoder.encode(comment, "UTF-8");
	} catch(UnsupportedEncodingException e) {
		e.printStackTrace();
		return note;
	}
	String url = new StringBuilder()
		.append("notes/")
		.append(note.getId())
		.append("/comment?text=")
		.append(encodedComment).toString();
	
	String response = sendRequest("POST", url, null, monitor, true, false);
	List<Note> modifiedNote = parseNotes(response);
	if(modifiedNote.size() !=0) {
		return modifiedNote.get(0);
	}
       return note;
}
 
开发者ID:iandees,项目名称:josm-notes,代码行数:26,代码来源:NotesCapableOsmApi.java

示例10: loadUrl

import org.openstreetmap.josm.gui.progress.ProgressMonitor; //导入依赖的package包/类
@Override
public Future<?> loadUrl(boolean newLayer, String url, ProgressMonitor progressMonitor) {
    CheckParameterUtil.ensureParameterNotNull(url, "url");
    
    Main.debug("[DownloadIlocateTask.loadUrl] URL loading");
    
    downloadTask = new DownloadTask(newLayer, url, progressMonitor);
    return Main.worker.submit(downloadTask);
}
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:10,代码来源:DownloadIlocateTask.java

示例11: importData

import org.openstreetmap.josm.gui.progress.ProgressMonitor; //导入依赖的package包/类
@Override
public void importData(final File file, ProgressMonitor progressMonitor) throws IOException, IllegalDataException {
    if (MainApplication.getLayerManager().getEditLayer() == null) {
        GuiHelper.runInEDT(() -> new Notification(tr("Please open or create data layer before importing")).show());
        return;
    }
    GuiHelper.runInEDTAndWait(() -> {
        ImportDialog dlg = new ImportDialog();
        if (dlg.getValue() != 1) return;
        dlg.saveSettings();
        MainApplication.worker.submit(new DxfImportTask(file));
    });
}
 
开发者ID:JOSM,项目名称:Dxf-Import,代码行数:14,代码来源:DxfImporter.java

示例12: getNotesInBoundingBox

import org.openstreetmap.josm.gui.progress.ProgressMonitor; //导入依赖的package包/类
public List<Note> getNotesInBoundingBox(Bounds bounds) throws OsmTransferException {
	ProgressMonitor monitor = NullProgressMonitor.INSTANCE;
	
	String url = new StringBuilder()
		.append("notes?bbox=")
		.append(bounds.getMin().lon())
		.append(",").append(bounds.getMin().lat())
           .append(",").append(bounds.getMax().lon())
           .append(",").append(bounds.getMax().lat())
           .toString();
	String response = sendRequest("GET", url, null, monitor, false, false);
	return parseNotes(response);
}
 
开发者ID:iandees,项目名称:josm-notes,代码行数:14,代码来源:NotesCapableOsmApi.java

示例13: importData

import org.openstreetmap.josm.gui.progress.ProgressMonitor; //导入依赖的package包/类
@Override
public void importData(File file, ProgressMonitor progressMonitor) throws IOException {
    try {
        MbtilesLayer layer = new MbtilesLayer(file);
        MainApplication.getLayerManager().addLayer(layer);
    } catch (MbtilesException e) {
        Logging.logWithStackTrace(Logging.LEVEL_WARN, "Error importing data", e);
        throw new IOException(tr("Loading MBTiles failed"), e);
    }
}
 
开发者ID:iandees,项目名称:josm-mbtiles,代码行数:11,代码来源:MbtilesFileImporter.java

示例14: parsePesce

import org.openstreetmap.josm.gui.progress.ProgressMonitor; //导入依赖的package包/类
protected DataSet parsePesce(InputStream in, ProgressMonitor instance)
        throws IllegalDataException {
    
    // Test: print context
    Main.debug("i-locate upload context");
    Map<String,String> context = Context.getInstance().store; 
    for(String k : context.keySet()) {
        Main.debug(String.format("%s -> %s",k,context.get(k)));
    }
    
    DataSet data = new DataSet();
    
    data.setUploadDiscouraged(true);
    
    data.beginUpdate();
    for(String line : convertStreamToString(in).split("\n")) {
        String[] s = line.split(",");
        if(s.length<2) {
            continue;
        }
        double lat = Double.parseDouble(s[0]);
        double lon = Double.parseDouble(s[1]);
        double scale = s.length>2 ? Double.parseDouble(s[2]) : 5.;

        Map<String, String> keys;
        Relation polygon = new Relation();
        keys = new HashMap<>();
        keys.put("type", "multipolygon");
        polygon.setKeys(keys);
        for(int j=0 ; j<2; j++){
            Node first = null;
            Way fishWay = new Way();
            for(int i=0 ; i<Constants.DELTA[j].length ; i++) {
                Node n = new Node(new LatLon(lat + scale * Constants.DELTA[j][i][0],lon + scale * Constants.DELTA[j][i][1]));
                keys = n.getKeys();
                if(null==keys){
                    keys = new HashMap<>();
                }
                if(Constants.DELTA[j][i].length > 2) {
                    if(Constants.DELTA[j][i][2] == 1.) {
                        keys.put("name", "testa");
                    } else if(Constants.DELTA[j][i][2] == 2.) {
                        keys.put("name", "coda");
                    }
                }
                if(null == first) {
                    first = n;
                }
                n.setKeys(keys);
    
                data.addPrimitive(n);
                fishWay.addNode(n);
            }
            fishWay.addNode(first);
            data.addPrimitive(fishWay);
            polygon.addMember(new RelationMember(j == 0 ? "outer" : "inner", fishWay));
        }
        data.addPrimitive(polygon);    
    }
    
    data.endUpdate();
    return data;
}
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:64,代码来源:PesceImporter.java

示例15: DownloadTask

import org.openstreetmap.josm.gui.progress.ProgressMonitor; //导入依赖的package包/类
public DownloadTask(boolean newLayer, String url, ProgressMonitor progressMonitor) {
    // Always create a new level
    super(true, tr("Downloading i-locate data"), progressMonitor, false, false);
    this.url = url;
}
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:6,代码来源:DownloadIlocateTask.java


注:本文中的org.openstreetmap.josm.gui.progress.ProgressMonitor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。