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


Java DataSet类代码示例

本文整理汇总了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);
    }
    
    
}
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:24,代码来源:PesceImporter.java

示例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);
    }
}
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:18,代码来源:DownloadIlocateTask.java

示例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);
}
 
开发者ID:JOSM,项目名称:geojson,代码行数:20,代码来源:DataSetBuilder.java

示例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;
}
 
开发者ID:bwr57,项目名称:CustomizePublicTransportStop,代码行数:36,代码来源:CreateNewStopPointOperation.java

示例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;
	}
}
 
开发者ID:MilanNobonn,项目名称:freemapKaPor,代码行数:26,代码来源:ExportPanel.java

示例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;
}
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:10,代码来源:PescePlugin.java

示例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);
}
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:10,代码来源:TransactionIds.java

示例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);
}
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:9,代码来源:OSMConverter.java

示例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);
}
 
开发者ID:kolesar-andras,项目名称:josm-plugin-improve-way,代码行数:39,代码来源:ImproveWayAccuracyAction.java

示例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();
}
 
开发者ID:kolesar-andras,项目名称:josm-plugin-improve-way,代码行数:14,代码来源:ImproveWayAccuracyAction.java

示例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);
			}
		}
	}
}
 
开发者ID:ztmtoosm,项目名称:easy-routes,代码行数:32,代码来源:PTAction.java

示例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);
    }
}
 
开发者ID:JOSM,项目名称:Dxf-Import,代码行数:13,代码来源:DxfImportTaskTest.java

示例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();
        }
    };
}
 
开发者ID:JOSM,项目名称:ShapeTools,代码行数:16,代码来源:ShapeEvents.java

示例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();
                    }
                }
            }
        }
    };
}
 
开发者ID:JOSM,项目名称:ShapeTools,代码行数:28,代码来源:ShapeEvents.java

示例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);
            }
        }
    };
}
 
开发者ID:JOSM,项目名称:ShapeTools,代码行数:29,代码来源:ShapeEvents.java


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