org.matsim.api.core.v01.network.Node.getAttributes()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(168)

本文整理了Java中org.matsim.api.core.v01.network.Node.getAttributes()方法的一些代码示例,展示了Node.getAttributes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getAttributes()方法的具体详情如下:
包路径:org.matsim.api.core.v01.network.Node
类名称:Node
方法名:getAttributes

Node.getAttributes介绍

暂无

代码示例

代码示例来源:origin: matsim-org/matsim

  1. @Override
  2. public Attributes getAttributes() {
  3. return node.getAttributes();
  4. }
  5. }

代码示例来源:origin: matsim-org/matsim

  1. private void startNode(final Attributes atts) {
  2. final Node node =
  3. this.network.getFactory().createNode(
  4. Id.create(atts.getValue("id"), Node.class),
  5. parseCoord(atts));
  6. this.network.addNode(node);
  7. NetworkUtils.setType(node,atts.getValue("type"));
  8. // (did not have a null check when I found it. kai, jul'16)
  9. if (atts.getValue(NetworkUtils.ORIGID) != null) {
  10. NetworkUtils.setOrigId( node, atts.getValue(NetworkUtils.ORIGID) ) ;
  11. }
  12. currentAttributes = node.getAttributes();
  13. }

代码示例来源:origin: matsim-org/matsim

  1. @Override
  2. public void startNode(final Node node, final BufferedWriter out) throws IOException {
  3. out.write("\t\t<node");
  4. out.write(" id=\"" + node.getId() + "\"");
  5. final Coord coord = transformation.transform( node.getCoord() );
  6. out.write(" x=\"" + coord.getX() + "\"");
  7. out.write(" y=\"" + coord.getY() + "\"");
  8. if ( coord.hasZ() ) out.write(" z=\"" + coord.getZ() + "\"");
  9. if (NetworkUtils.getType( node ) != null) {
  10. out.write(" type=\"" + NetworkUtils.getType( node ) + "\"");
  11. }
  12. if (NetworkUtils.getOrigId( node ) != null) {
  13. out.write(" origid=\"" + NetworkUtils.getOrigId( node ) + "\"");
  14. }
  15. out.write(" >\n");
  16. attributesWriter.writeAttributes( "\t\t\t" , out , node.getAttributes() );
  17. }

代码示例来源:origin: matsim-org/matsim

  1. @Test
  2. public void testNodesAttributes() {
  3. final Scenario sc = createTestNetwork( false );
  4. new NetworkWriter( sc.getNetwork() ).writeV2( utils.getOutputDirectory()+"network.xml" );
  5. final Scenario read = ScenarioUtils.createScenario( ConfigUtils.createConfig() );
  6. new MatsimNetworkReader( read.getNetwork() ).readFile( utils.getOutputDirectory()+"network.xml" );
  7. final Id<Node> id = Id.createNodeId( "Zurich" );
  8. Assert.assertEquals( "unexpected internet attribute in node metadata",
  9. "good",
  10. read.getNetwork().getNodes().get( id ).getAttributes().getAttribute( "Internet" ) );
  11. Assert.assertEquals( "unexpected meeting attribute in node metadata",
  12. false,
  13. read.getNetwork().getNodes().get( id ).getAttributes().getAttribute( "Developper Meeting" ) );
  14. }

代码示例来源:origin: matsim-org/matsim

  1. .getNodes()
  2. .get( Id.createNodeId( 1 ) )
  3. .getAttributes()
  4. .getAttribute( "nodeAttribute" );

代码示例来源:origin: matsim-org/matsim

  1. new Coord( 1 , 1 ) );
  2. zurichNode.getAttributes().putAttribute( "Internet" , "good" );
  3. zurichNode.getAttributes().putAttribute( "Developper Meeting" , false );
  4. teltowNode.getAttributes().putAttribute( "Internet" , "not so good" );
  5. teltowNode.getAttributes().putAttribute( "Developper Meeting" , true );

代码示例来源:origin: matsim-org/matsim

  1. final Node node2 = factory.createNode( Id.createNodeId( 2 ) , new Coord( 1 , 1) );
  2. node1.getAttributes().putAttribute( "nodeAttribute" , new StupidClass() );
  3. node2.getAttributes().putAttribute( "nodeAttribute" , new StupidClass() );

相关文章