• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DataSet类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



DataSet类属于org.openstreetmap.josm.data.osm包,在下文中一共展示了DataSet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: addUploadInfo

import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的package包/类
public static void addUploadInfo(String layerName, DataSet dataSet, String url, LayerType type) {
    Main.debug("[PescePlugin.addUploadInfo] "+layerName+" "+dataSet.toString()+" "+url);
    getUploadInfo().add(new UploadInfo(layerName, dataSet, url, type));
}
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:5,代码来源:PescePlugin.java


示例17: UploadInfo

import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的package包/类
public UploadInfo(String layerName, DataSet dataSet, String url, LayerType type) {
    this.layerName = layerName;
    this.dataSet = dataSet;
    this.url = url;
    this.type = type;
}
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:7,代码来源:PescePlugin.java


示例18: doSave

import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的package包/类
public static void doSave(File file, DataSet ds) throws IOException, FileNotFoundException  {
    
    String json = getPolygons(ds);
    Main.debug(json);
    toFile(file, json);
}
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:7,代码来源:GeoJsonPolygonsExporter.java


示例19: getPolygons

import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的package包/类
private static String getPolygons(DataSet ds) {
    // WARNING: this function flats all layers into one
    
    IdsFactory ids = new IdsFactory();
    
    JSONObject featureCollection = new JSONObject();
    try {
        featureCollection.put("type", "FeatureCollection");
        JSONArray featureList = new JSONArray();
        // iterate through your list
        Main.debug(">ways size> "+ds.getWays().size());
        for (Way way : ds.getWays()) {
            
            List<Node> nodes = way.getNodes();
            
            // A way is a polygon if the first node and the last are the same
            if(nodes.size()<3 || nodes.get(0) != nodes.get(nodes.size()-1)) {
                Main.debug("[getPolygons] Skip way, this is not a polygon");
                continue;
            }
            
            JSONObject georoom = new JSONObject();
            georoom.put("type", "Polygon");//fisso
            // construct a JSONArray from a string; can also use an array or list
            JSONArray coord = new JSONArray();
            JSONArray tmp, tmp2 = new JSONArray();
            
            Main.debug(">way's referrers> "+way.getNodesCount());
            
            for (Node n : nodes) {
                Main.debug(">a node> ");
                tmp = new JSONArray();
                
                tmp.put(n.getCoor().getX());
                tmp.put(n.getCoor().getY());
                tmp2.put(tmp);
            }
            coord.put(tmp2);

            georoom.put("coordinates", coord);
            JSONObject feature = new JSONObject();
            feature.put("geometry", georoom);
            JSONObject proroom = new JSONObject();
            proroom.put("name", way.getName());//facoltativo/
            proroom.put("id", way.getId()==0 ? -ids.newIntId("POLYGONID",1) : way.getId());//id room
            proroom.put("geomType", "room");//tipo fisso
            if(null != way.get(Constants.OSM_KEY_LEVEL)) {
                proroom.put("level", way.get(Constants.OSM_KEY_LEVEL));//livello-piano    
            }
            
            feature.put("properties", proroom);
            feature.put("type", "Feature");

            featureList.put(feature);
            featureCollection.put("features", featureList);
        }
    } catch (JSONException e) {
        Main.debug("Export error");
    }
    
    
    return featureCollection.toString();
}
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:64,代码来源:GeoJsonPolygonsExporter.java


示例20: doSave

import org.openstreetmap.josm.data.osm.DataSet; //导入依赖的package包/类
public static void doSave(Writer writer, DataSet data) throws IOException, FileNotFoundException  {
    doSave(null, writer, data);
}
 
开发者ID:STEMLab,项目名称:JOSM-IndoorEditor,代码行数:4,代码来源:PesceExporter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CroppedTrack类代码示例发布时间:2022-05-22
下一篇:
Java EncodedDataInputStream类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap