本文整理汇总了Java中org.openstreetmap.josm.gui.layer.OsmDataLayer类的典型用法代码示例。如果您正苦于以下问题:Java OsmDataLayer类的具体用法?Java OsmDataLayer怎么用?Java OsmDataLayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OsmDataLayer类属于org.openstreetmap.josm.gui.layer包,在下文中一共展示了OsmDataLayer类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: action
import org.openstreetmap.josm.gui.layer.OsmDataLayer; //导入依赖的package包/类
public boolean action(Event evt, Object arg) {
try {
KatApplet map = KaporMenuActionListener.applet;
DataSet dataset;
if (arg.equals("Export"))
dataset = ExportAll.exportAll(map);
else if (arg.equals("Budovy"))
dataset = ExportBudovy.exportBudovy(map);
else
return false;
if (dataset.getNodes().size() > 0)
Main.main.addLayer(new OsmDataLayer(dataset, OsmDataLayer
.createNewName(), null));
return true;
} catch (TransformException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
}
开发者ID:MilanNobonn,项目名称:freemapKaPor,代码行数:26,代码来源:ExportPanel.java
示例2: getLayer
import org.openstreetmap.josm.gui.layer.OsmDataLayer; //导入依赖的package包/类
static public OsmDataLayer getLayer(DataSet data) {
if (!Main.isDisplayingMapView()) return null;
Collection<Layer> layers = Main.map.mapView.getAllLayersAsList();
for (Layer layer : layers) {
if (layer instanceof OsmDataLayer && ((OsmDataLayer) layer).data==data)
return (OsmDataLayer) layer;
}
return null;
}
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:10,代码来源:PescePlugin.java
示例3: testDxfImportTask
import org.openstreetmap.josm.gui.layer.OsmDataLayer; //导入依赖的package包/类
@Test
public void testDxfImportTask() throws Exception {
OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
MainApplication.getLayerManager().addLayer(layer);
try {
for (Path p : listDataFiles("dxf")) {
doTestDxfFile(p.toFile());
}
} finally {
MainApplication.getLayerManager().removeLayer(layer);
}
}
开发者ID:JOSM,项目名称:Dxf-Import,代码行数:13,代码来源:DxfImportTaskTest.java
示例4: initAlignAll
import org.openstreetmap.josm.gui.layer.OsmDataLayer; //导入依赖的package包/类
private void initAlignAll() {
alignAllBuildings = new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
ShapeMode mode = ShapeToolsPlugin.getMode();
if (mode != null) {
DrawableSegmentRoad road = ShapeMode.roadSegm;
if (road != null) {
try {
Logging.debug("AlignAllBuildings button pressed, non-null parameters found");
double epsilon = Double.parseDouble(epsilonInput.getText());
OsmDataLayer currentLayer = MainApplication.getLayerManager().getEditLayer();
DataSet data = currentLayer.data;
Collection<Way> selectedWays = data.getSelectedWays();
for (Way way : selectedWays) {
ShapeMath.alignUsingEpsilon(road.segment, way, epsilon);
ShapeMode.cleanup();
MainApplication.getMap().repaint();
}
} catch (NumberFormatException ex) {
new Notification(tr("Please enter minimal distance in metres")).show();
}
}
}
}
};
}
开发者ID:JOSM,项目名称:ShapeTools,代码行数:28,代码来源:ShapeEvents.java
示例5: initRotate
import org.openstreetmap.josm.gui.layer.OsmDataLayer; //导入依赖的package包/类
private void initRotate() {
rotate = new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
double angle = 0;
try {
angle = Math.toRadians(Double.parseDouble(angleInput.getText()));
} catch (NumberFormatException ex) {
new Notification(tr("Please enter numeric angle in degrees")).show();
} catch (Throwable ex) {
Logging.error(ex);
}
OsmDataLayer currentLayer = MainApplication.getLayerManager().getEditLayer();
DataSet data = currentLayer.data;
Collection<Node> selectedNodes = data.getSelectedNodes();
Collection<Way> selectedWays = data.getSelectedWays();
if (directionComboBox.getSelectedIndex() == 0) {
Logging.debug("User requires clockwise rotation");
Logging.debug("Using angle: " + -angle);
ShapeMath.doRotate(selectedWays, selectedNodes, -angle);
} else if (directionComboBox.getSelectedIndex() == 1) {
Logging.debug("User requires antiClockwise rotation");
Logging.debug("Using angle: " + angle);
ShapeMath.doRotate(selectedWays, selectedNodes, angle);
}
}
};
}
开发者ID:JOSM,项目名称:ShapeTools,代码行数:29,代码来源:ShapeEvents.java
示例6: acceptFile
import org.openstreetmap.josm.gui.layer.OsmDataLayer; //导入依赖的package包/类
@Override
public boolean acceptFile(File pathname, Layer layer) {
if (!(layer instanceof OsmDataLayer))
return false;
return super.acceptFile(pathname, layer);
}
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:7,代码来源:GeoJsonPolygonsExporter.java
示例7: checkOsmDataLayer
import org.openstreetmap.josm.gui.layer.OsmDataLayer; //导入依赖的package包/类
protected static void checkOsmDataLayer(Layer layer) throws IllegalArgumentException {
if (!(layer instanceof OsmDataLayer)) {
throw new IllegalArgumentException(MessageFormat.format("Expected instance of OsmDataLayer. Got ''{0}''.", layer
.getClass().getName()));
}
}
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:7,代码来源:GeoJsonPolygonsExporter.java
示例8: save
import org.openstreetmap.josm.gui.layer.OsmDataLayer; //导入依赖的package包/类
private void save(File file, OsmDataLayer layer, boolean noBackup) {
File tmpFile = null;
try {
// use a tmp file because if something errors out in the
// process of writing the file, we might just end up with
// a truncated file. That can destroy lots of work.
if (file.exists()) {
tmpFile = new File(file.getPath() + "~");
Utils.copyFile(file, tmpFile);
}
doSave(file, layer.data);
if (noBackup || !Main.pref.getBoolean("save.keepbackup", false)) {
if (tmpFile != null) {
tmpFile.delete();
}
}
layer.onPostSaveToFile();
} catch (IOException e) {
Main.error(e);
JOptionPane.showMessageDialog(
Main.parent,
tr("<html>An error occurred while saving.<br>Error is:<br>{0}</html>", e.getMessage()),
tr("Error"),
JOptionPane.ERROR_MESSAGE
);
try {
// if the file save failed, then the tempfile will not
// be deleted. So, restore the backup if we made one.
if (tmpFile != null && tmpFile.exists()) {
Utils.copyFile(tmpFile, file);
}
} catch (IOException e2) {
Main.error(e2);
JOptionPane.showMessageDialog(
Main.parent,
tr("<html>An error occurred while restoring backup file.<br>Error is:<br>{0}</html>", e2.getMessage()),
tr("Error"),
JOptionPane.ERROR_MESSAGE
);
}
}
}
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:46,代码来源:GeoJsonPolygonsExporter.java
示例9: save
import org.openstreetmap.josm.gui.layer.OsmDataLayer; //导入依赖的package包/类
private void save(File file, OsmDataLayer layer, boolean noBackup) {
File tmpFile = null;
try {
// use a tmp file because if something errors out in the
// process of writing the file, we might just end up with
// a truncated file. That can destroy lots of work.
if (file.exists()) {
tmpFile = new File(file.getPath() + "~");
Utils.copyFile(file, tmpFile);
}
doSave(file, layer.data);
if (noBackup || !Main.pref.getBoolean("save.keepbackup", false)) {
if (tmpFile != null) {
tmpFile.delete();
}
}
layer.onPostSaveToFile();
} catch (IOException e) {
Main.error(e);
JOptionPane.showMessageDialog(
Main.parent,
tr("<html>An error occurred while saving.<br>Error is:<br>{0}</html>", e.getMessage()),
tr("Error"),
JOptionPane.ERROR_MESSAGE
);
try {
// if the file save failed, then the tempfile will not
// be deleted. So, restore the backup if we made one.
if (tmpFile != null && tmpFile.exists()) {
Utils.copyFile(tmpFile, file);
}
} catch (IOException e2) {
Main.error(e2);
JOptionPane.showMessageDialog(
Main.parent,
tr("<html>An error occurred while restoring backup file.<br>Error is:<br>{0}</html>", e2.getMessage()),
tr("Error"),
JOptionPane.ERROR_MESSAGE
);
}
}
}
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:45,代码来源:PesceExporter.java
示例10: realRun
import org.openstreetmap.josm.gui.layer.OsmDataLayer; //导入依赖的package包/类
@Override
protected void realRun() throws SAXException, IOException, OsmTransferException {
for(UploadInfo info : PescePlugin.getUploadInfo()) {
if(cancel) return;
progressMonitor.beginTask(tr("Converting {0} data...",info.layerName));
StringWriter sw = new StringWriter();
String contentType = null;
OsmDataLayer layer = PescePlugin.getLayer(info.dataSet);
if(null != layer) {
layer.onPostUploadToServer();
Main.debug("[IlocateUploadTask.realRun] Layer name: "+layer.getName());
} else {
Main.error("[IlocateUploadTask.realRun] Layer not found. It could be removed");
cancel();
return;
}
switch(info.type) {
case BUILDING:
Main.debug("[IlocateUploadTask.realRun] Building layer upload not implemented");
contentType = "application/json";
break;
case IGML:
Main.debug("[IlocateUploadTask.realRun] IGML");
PesceExporter.doSave(sw, info.dataSet);
// I need the OsmLayer of dataset here
// layer.onPostUploadToServer();
contentType = "text/xml";
break;
}
progressMonitor.beginTask(tr("Uploading {0} data...",info.layerName));
// String diffUploadResponse = sendRequest("POST", "changeset/" + changeset.getId() + "/upload", diffUploadRequest,monitor);
boolean uploadImplemented = false;
if(uploadImplemented) {
response = postRequest(new URL(info.url), sw.toString(), contentType, progressMonitor, false, true);
Main.debug(response);
}
}
}
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:50,代码来源:IlocateUploadTask.java
示例11: layerIsSupported
import org.openstreetmap.josm.gui.layer.OsmDataLayer; //导入依赖的package包/类
@Override
public boolean layerIsSupported(Layer l) {
return l instanceof OsmDataLayer;
}
开发者ID:kolesar-andras,项目名称:josm-plugin-improve-way,代码行数:5,代码来源:ImproveWayAccuracyAction.java
示例12: layerAdded
import org.openstreetmap.josm.gui.layer.OsmDataLayer; //导入依赖的package包/类
public void layerAdded(Layer newLayer) {
if(newLayer instanceof OsmDataLayer) {
// start the auto download loop
NavigatableComponent.addZoomChangeListener(this);
}
}
开发者ID:iandees,项目名称:josm-notes,代码行数:7,代码来源:NotesPlugin.java
示例13: exportData
import org.openstreetmap.josm.gui.layer.OsmDataLayer; //导入依赖的package包/类
@Override
public void exportData(File file, Layer layer) throws IOException {
checkOsmDataLayer(layer);
save(file, (OsmDataLayer) layer, true);
}
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:8,代码来源:GeoJsonPolygonsExporter.java
示例14: exportData
import org.openstreetmap.josm.gui.layer.OsmDataLayer; //导入依赖的package包/类
/**
* Exports OSM data to the given file.
* @param file Output file
* @param layer Data layer. Must be an instance of {@link OsmDataLayer}.
* @param noBackup if {@code true}, the potential backup file created if the output file already exists will be deleted
* after a successful export
* @throws IllegalArgumentException if {@code layer} is not an instance of {@code OsmDataLayer}
*/
public void exportData(File file, Layer layer, boolean noBackup) throws IllegalArgumentException {
checkOsmDataLayer(layer);
save(file, (OsmDataLayer) layer, noBackup);
}
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:13,代码来源:PesceExporter.java
注:本文中的org.openstreetmap.josm.gui.layer.OsmDataLayer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论