本文整理汇总了Java中org.openstreetmap.josm.data.osm.DataSet类的典型用法代码示例。如果您正苦于以下问题:Java DataSet类的具体用法?Java DataSet怎么用?Java DataSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataSet类属于org.openstreetmap.josm.data.osm包,在下文中一共展示了DataSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseDataSet
import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的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);
}
}
示例2: getDataForFile
import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的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);
}
}
示例3: build
import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的package包/类
public BoundedDataSet build(final GeoJsonObject data) {
dataSet = new DataSet();
if (data instanceof FeatureCollection) {
processFeatureCollection((FeatureCollection) data);
} else if (data instanceof GeometryCollection) {
processGeometryCollection(null, (GeometryCollection) data);
} else if (data instanceof Feature) {
processFeature((Feature) data);
} else {
processGeometry(null, data);
}
Bounds bounds = null;
for (OsmPrimitive osmPrimitive : dataSet.allPrimitives()) {
bounds = mergeBounds(bounds, osmPrimitive);
}
return new BoundedDataSet(dataSet, bounds);
}
示例4: getNearestNodesImpl
import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的package包/类
/**
* The *result* does not depend on the current map selection state,
* neither does the result *order*.
* It solely depends on the distance to point p.
*
* This code is coped from JOSM code
*
* @return a sorted map with the keys representing the distance of
* their associated nodes to point p.
*/
private Map<Double, List<Node>> getNearestNodesImpl(Point p) {
TreeMap<Double, List<Node>> nearestMap = new TreeMap<>();
DataSet ds = getCurrentDataSet();
if (ds != null) {
double dist, snapDistanceSq = 200;
snapDistanceSq *= snapDistanceSq;
for (Node n : ds.searchNodes(getBBox(p, 200))) {
if ((dist = Main.map.mapView.getPoint2D(n).distanceSq(p)) < snapDistanceSq)
{
List<Node> nlist;
if (nearestMap.containsKey(dist)) {
nlist = nearestMap.get(dist);
} else {
nlist = new LinkedList<>();
nearestMap.put(dist, nlist);
}
nlist.add(n);
}
}
}
return nearestMap;
}
示例5: action
import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的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;
}
}
示例6: getLayer
import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的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;
}
示例7: getInstance
import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的package包/类
public static TransactionIds getInstance(DataSet ds) {
if(null==instances) {
instances = new HashMap<>();
}
if(!instances.containsKey(ds)) {
instances.put(ds,new TransactionIds());
}
return instances.get(ds);
}
示例8: OSMConverter
import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的package包/类
private OSMConverter(DataSet data) {
nodes = data.getNodes();
ways = data.getWays();
relations = data.getRelations();
idsFactory = new IdsFactory();
//txIds = TransactionIds.getInstance(data);
}
示例9: enterMode
import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的package包/类
@Override
public void enterMode() {
if (!isEnabled()) {
return;
}
super.enterMode();
mv = Main.map.mapView;
mousePos = null;
oldModeHelpText = "";
if (getCurrentDataSet() == null) {
return;
}
updateStateByCurrentSelection();
Main.map.keyDetector.addKeyListener(this);
Main.map.mapView.addMouseListener(this);
Main.map.mapView.addMouseMotionListener(this);
Main.map.mapView.addTemporaryLayer(this);
DataSet.addSelectionListener(this);
Main.map.keyDetector.addModifierListener(this);
if (!isExpert) return;
helpersEnabled = false;
keypressTime = 0;
resetTimer();
longKeypressTimer.schedule(new TimerTask() {
@Override
public void run() {
helpersEnabled = true;
helpersUseOriginal = true;
Main.map.mapView.repaint();
}
}, longKeypressTime);
}
示例10: exitMode
import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的package包/类
@Override
public void exitMode() {
super.exitMode();
Main.map.keyDetector.removeKeyListener(this);
Main.map.mapView.removeMouseListener(this);
Main.map.mapView.removeMouseMotionListener(this);
Main.map.mapView.removeTemporaryLayer(this);
DataSet.removeSelectionListener(this);
Main.map.keyDetector.removeModifierListener(this);
Main.map.mapView.repaint();
}
示例11: actionPerformed
import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
DataSet ds = Main.main.getCurrentDataSet();
Collection<Way> ajWaj = ds.getWays();
for(Way x : ajWaj) {
if(x.keySet().size()==0 && x.getNodes().size()==2) {
Node stop = null;
Node transport = null;
if("bus_stop".equals(x.getNodes().get(0).getKeys().get("highway"))) {
stop=x.getNodes().get(0);
transport=x.getNodes().get(1);
}
if("bus_stop".equals(x.getNodes().get(1).getKeys().get("highway"))) {
stop=x.getNodes().get(1);
transport=x.getNodes().get(0);
}
if(stop!=null && transport !=null) {
x.setDeleted(true);
Map<String,String> foo = stop.getKeys();
if(foo.get("ref:ztm")!=null) {
transport.put("ref:ztm", foo.get("ref:ztm"));
}
if(foo.get("name")!=null) {
transport.put("name", foo.get("name"));
}
transport.put("public_transport", "stop_position");
transport.setModified(true);
}
}
}
}
示例12: testDxfImportTask
import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的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);
}
}
示例13: initAlign
import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的package包/类
private void initAlign() {
this.align = new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
DataSet data = MainApplication.getLayerManager().getEditDataSet();
Collection<Way> selectedWays = data.getSelectedWays();
List<Way> wayList = new ArrayList<>();
for (Way way : selectedWays) {
wayList.add(way);
}
ShapeMath.align(wayList.get(0), wayList.get(1));
ShapeMode.cleanup();
}
};
}
示例14: initAlignAll
import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的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();
}
}
}
}
};
}
示例15: initRotate
import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的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);
}
}
};
}