本文整理汇总了Java中org.openstreetmap.josm.gui.layer.Layer类的典型用法代码示例。如果您正苦于以下问题:Java Layer类的具体用法?Java Layer怎么用?Java Layer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Layer类属于org.openstreetmap.josm.gui.layer包,在下文中一共展示了Layer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: importData
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的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
示例2: mouseClicked
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的package包/类
@Override
public void mouseClicked(final MouseEvent event) {
if (SwingUtilities.isLeftMouseButton(event)) {
final Layer activeLayer = Main.getLayerManager().getActiveLayer();
final Point point = event.getPoint();
final boolean multiSelect = event.isShiftDown();
if (Util.zoom(Main.map.mapView.getRealBounds()) > Config.getInstance().getMaxClusterZoom()) {
if (activeLayer instanceof MissingGeometryLayer) {
// select tiles
selectItem(ServiceHandler.getMissingGeometryHandler(), missingGeometryLayer, point, multiSelect);
} else if (activeLayer instanceof DirectionOfFlowLayer) {
// select road segments
selectItem(ServiceHandler.getDirectionOfFlowHandler(), directionOfFlowLayer, point, multiSelect);
} else if (activeLayer instanceof TurnRestrictionLayer) {
selectTurnRestriction(point, multiSelect);
}
}
}
}
开发者ID:Telenav,项目名称:improve-osm-plugin,代码行数:20,代码来源:ImproveOsmPlugin.java
示例3: createComment
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的package包/类
@Override
public synchronized void createComment(final Comment comment) {
final List<Layer> layers = Main.getLayerManager().getLayers();
ThreadPool.getInstance().execute(() -> {
if (layers.contains(missingGeometryLayer) && missingGeometryLayer.hasSelectedItems()) {
createComment(ServiceHandler.getMissingGeometryHandler(), missingGeometryLayer,
new MissingGeometryUpdateThread(detailsDialog, missingGeometryLayer), comment);
} else if (layers.contains(directionOfFlowLayer) && directionOfFlowLayer.hasSelectedItems()) {
createComment(ServiceHandler.getDirectionOfFlowHandler(), directionOfFlowLayer,
new DirectionOfFlowUpdateThread(detailsDialog, directionOfFlowLayer), comment);
} else if (layers.contains(turnRestrictionLayer) && turnRestrictionLayer.hasSelectedItems()) {
createComment(ServiceHandler.getTurnRestrictionHandler(), turnRestrictionLayer,
new TurnRestrictionUpdateThread(detailsDialog, turnRestrictionLayer), comment);
}
});
}
开发者ID:Telenav,项目名称:improve-osm-plugin,代码行数:17,代码来源:ImproveOsmPlugin.java
示例4: actionPerformed
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的package包/类
@Override
public void actionPerformed(final ActionEvent event) {
if (event.getActionCommand().equals(GuiConfig.getInstance().getLblCopy())) {
final Layer activeLayer = Main.getLayerManager().getActiveLayer();
String selection = "";
if (activeLayer instanceof MissingGeometryLayer) {
if (missingGeometryLayer.hasSelectedItems()) {
selection = missingGeometryLayer.getSelectedItems().toString();
}
} else if (activeLayer instanceof DirectionOfFlowLayer) {
if (directionOfFlowLayer.hasSelectedItems()) {
selection = directionOfFlowLayer.getSelectedItems().toString();
}
} else if (activeLayer instanceof TurnRestrictionLayer && turnRestrictionLayer.hasSelectedItems()) {
selection = turnRestrictionLayer.getSelectedItems().toString();
}
ClipboardUtils.copyString(selection);
}
}
开发者ID:Telenav,项目名称:improve-osm-plugin,代码行数:20,代码来源:ImproveOsmPlugin.java
示例5: getLayer
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的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
示例6: layerOrderChanged
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的package包/类
@Override
public void layerOrderChanged(final LayerOrderChangeEvent event) {
final Layer oldLayer =
Main.getLayerManager().getLayers().size() > 1 ? Main.getLayerManager().getLayers().get(1) : null;
final Layer newLayer = Main.getLayerManager().getActiveLayer();
if (oldLayer != null && newLayer instanceof AbstractLayer) {
if (oldLayer instanceof MissingGeometryLayer) {
updateSelectedData(missingGeometryLayer, null, null);
} else if (oldLayer instanceof DirectionOfFlowLayer) {
updateSelectedData(directionOfFlowLayer, null, null);
} else if (oldLayer instanceof TurnRestrictionLayer) {
updateSelectedData(turnRestrictionLayer, null, null);
}
}
}
开发者ID:Telenav,项目名称:improve-osm-plugin,代码行数:16,代码来源:ImproveOsmPlugin.java
示例7: loadLastComment
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的package包/类
/**
* Loads the last comment from the preference file, based on the currently active layer.
*
* @return a {@code String} value
*/
public String loadLastComment() {
String lastComment = null;
final Layer activeLayer = Main.getLayerManager().getActiveLayer();
if (activeLayer instanceof DirectionOfFlowLayer) {
lastComment = loadManager.loadDirectionOfFlowLastComment();
} else if (activeLayer instanceof MissingGeometryLayer) {
lastComment = loadManager.loadMissingGeometryLastComment();
} else if (activeLayer instanceof TurnRestrictionLayer) {
lastComment = loadManager.loadTurnRestrictionLastComment();
}
return lastComment;
}
开发者ID:Telenav,项目名称:improve-osm-plugin,代码行数:18,代码来源:PreferenceManager.java
示例8: saveLastComment
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的package包/类
/**
* Saves the user's last comment in the preference file based on the given active layer.
*
* @param activeLayer the current active layer
* @param comment a {@code String} value
*/
public void saveLastComment(final Layer activeLayer, final String comment) {
if (activeLayer instanceof MissingGeometryLayer) {
saveManager.saveMissingGeoLastComment(comment);
} else if (activeLayer instanceof DirectionOfFlowLayer) {
saveManager.saveDirectionOfFlowLastComment(comment);
} else if (activeLayer instanceof TurnRestrictionLayer) {
saveManager.saveTurnRestrictionLastComment(comment);
}
}
开发者ID:Telenav,项目名称:improve-osm-plugin,代码行数:16,代码来源:PreferenceManager.java
示例9: updateUI
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的package包/类
private <T> void updateUI(final T item) {
synchronized (this) {
pnlBtn.enablePanelActions(item);
final Layer activeLayer = Util.getImproveOsmLayer();
if (activeLayer == null) {
// special case, all layers were removed and details panel's needs to be cleared
pnlTileInfo.updateData(null);
pnlRoadSegmentInfo.updateData(null);
pnlTurnRestrictionInfo.updateData(null);
} else {
final Component cmpInfoView = cmpInfo.getViewport().getView();
if (activeLayer instanceof MissingGeometryLayer) {
pnlTileInfo.updateData((Tile) item);
if (!(cmpInfoView instanceof TileInfoPanel)) {
cmpInfo.setViewportView(pnlTileInfo);
}
} else if (activeLayer instanceof DirectionOfFlowLayer) {
pnlRoadSegmentInfo.updateData((RoadSegment) item);
if (!(cmpInfoView instanceof RoadSegmentInfoPanel)) {
cmpInfo.setViewportView(pnlRoadSegmentInfo);
}
} else if (activeLayer instanceof TurnRestrictionLayer) {
pnlTurnRestrictionInfo.updateData((TurnRestriction) item);
if (!(cmpInfoView instanceof TurnRestrictionInfoPanel)) {
cmpInfo.setViewportView(pnlTurnRestrictionInfo);
}
}
}
cmpInfo.revalidate();
repaint();
}
}
开发者ID:Telenav,项目名称:improve-osm-plugin,代码行数:33,代码来源:ImproveOsmDetailsDialog.java
示例10: actionPerformed
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的package包/类
@Override
public void actionPerformed(final ActionEvent event) {
if (Main.map != null) {
final Layer activeLayer = Util.getImproveOsmLayer();
if (activeLayer instanceof MissingGeometryLayer) {
new MissingGeometryFilterDialog().setVisible(true);
} else if (activeLayer instanceof DirectionOfFlowLayer) {
new DirectionOfFlowFilterDialog().setVisible(true);
} else if (activeLayer instanceof TurnRestrictionLayer) {
new TurnRestrictionFilterDialog().setVisible(true);
}
}
}
开发者ID:Telenav,项目名称:improve-osm-plugin,代码行数:14,代码来源:ButtonPanel.java
示例11: mouseReleased
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的package包/类
@Override public void mouseReleased(MouseEvent e) {
if(dragged) {
Layer y = Main.main.getActiveLayer();
if(y.getClass()==RoutingLayer.class) {
RoutingLayer yy = (RoutingLayer)(y);
try {
yy.dragAction(e.getX(), e.getY());
} catch (NodeConnectException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
dragged = false;
}
开发者ID:ztmtoosm,项目名称:easy-routes,代码行数:16,代码来源:EditRoutingLayerAction.java
示例12: mouseClicked
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的package包/类
@Override public void mouseClicked(MouseEvent e) {
Layer y = Main.main.getActiveLayer();
if(y.getClass()==RoutingLayer.class) {
RoutingLayer yy = (RoutingLayer)(y);
yy.addMiddleNode();
}
}
开发者ID:ztmtoosm,项目名称:easy-routes,代码行数:9,代码来源:EditRoutingLayerAction.java
示例13: mouseMoved
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的package包/类
@Override public void mouseMoved(MouseEvent e) {
Layer y = Main.main.getActiveLayer();
if(y.getClass()==RoutingLayer.class) {
RoutingLayer yy = (RoutingLayer)(y);
yy.setProposedPoint(e.getX(), e.getY());
}
}
开发者ID:ztmtoosm,项目名称:easy-routes,代码行数:8,代码来源:EditRoutingLayerAction.java
示例14: acceptFile
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的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
示例15: checkOsmDataLayer
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的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
示例16: exportData
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的package包/类
@Override
public void exportData(File file, Layer layer) throws IOException {
exportData(file, layer, false);
}
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:6,代码来源:PesceExporter.java
示例17: layerIsSupported
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的package包/类
@Override
public boolean layerIsSupported(Layer l) {
return l instanceof OsmDataLayer;
}
开发者ID:kolesar-andras,项目名称:josm-plugin-improve-way,代码行数:5,代码来源:ImproveWayAccuracyAction.java
示例18: isMergable
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的package包/类
@Override
public boolean isMergable(final Layer layer) {
return false;
}
开发者ID:Telenav,项目名称:scoutsigns,代码行数:5,代码来源:ScoutSignsLayer.java
示例19: mergeFrom
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的package包/类
@Override
public void mergeFrom(final Layer layer) {
// merge operation is not supported
}
开发者ID:Telenav,项目名称:scoutsigns,代码行数:5,代码来源:ScoutSignsLayer.java
示例20: mergeFrom
import org.openstreetmap.josm.gui.layer.Layer; //导入依赖的package包/类
@Override
public void mergeFrom(final Layer layer) {
// this operation is not supported
}
开发者ID:Telenav,项目名称:improve-osm-plugin,代码行数:5,代码来源:AbstractLayer.java
注:本文中的org.openstreetmap.josm.gui.layer.Layer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论