Package org.osm2world.core.map_data.data

Examples of org.osm2world.core.map_data.data.MapWaySegment


       
        List<MapWaySegment> connectedNLines = new ArrayList<MapWaySegment>(2);
        connectedNLines.addAll(inboundNLines);
        connectedNLines.addAll(outboundNLines);
       
        MapWaySegment line1 = connectedNLines.get(0);
        MapWaySegment line2 = connectedNLines.get(1);
       
        calculateConnectorNodeEffects(node.getPrimaryRepresentation(),
            line1, line2,
            inboundNLines.contains(line1),
            inboundNLines.contains(line2));
View Full Code Here


      }
     
    } else if (from == to
        && segments.get(from) instanceof MapWaySegment) { //usually at the end of a noexit road
     
      MapWaySegment segment = (MapWaySegment) segments.get(from);
     
      if (segment.getPrimaryRepresentation() instanceof NetworkWaySegmentWorldObject) {
       
        NetworkWaySegmentWorldObject rep =
          (NetworkWaySegmentWorldObject) segment.getPrimaryRepresentation();
       
        //TODO: the calculations for pos1/2 should be part of the NetworkLineRepresentation (it's used quite often)
       
        if (segment.getEndNode() == node) { //inbound segment
         
          VectorXZ pos1 = node.getPos()
            .add(rep.getEndOffset())
            .add(rep.getEndCutVector().mult(rep.getWidth()/2));
         
View Full Code Here

       
        OSMNode previousNode = null;
        for (OSMNode node : way.nodes) {
          if (previousNode != null) {
           
            MapWaySegment mapWaySeg = new MapWaySegment(
                way, nodeMap.get(previousNode), nodeMap.get(node));
           
            mapWaySegs.add(mapWaySeg);
            nodeMap.get(previousNode).addOutboundLine(mapWaySeg);
            nodeMap.get(node).addInboundLine(mapWaySeg);
View Full Code Here

    List<MapWaySegment> connectedSegments =
        segment.getStartNode().getConnectedWaySegments();
   
    if (connectedSegments.size() == 2) {
     
      MapWaySegment previousSegment = null;
     
      for (MapWaySegment connectedSegment : connectedSegments) {
        if (connectedSegment != this.segment) {
          previousSegment = connectedSegment;
        }
      }
     
      WorldObject previousWO = previousSegment.getPrimaryRepresentation();
     
      if (previousWO instanceof AbstractNetworkWaySegmentWorldObject) {
       
        AbstractNetworkWaySegmentWorldObject previous =
            (AbstractNetworkWaySegmentWorldObject)previousWO;
View Full Code Here

      if (element instanceof MapNode) {
       
        return contains(((MapNode)element).getPos());
       
      } else if (element instanceof MapWaySegment) {
        MapWaySegment line = (MapWaySegment)element;
               
        VectorXZ lineStart = line.getStartNode().getPos();
        VectorXZ lineEnd = line.getEndNode().getPos();
       
        if (contains(lineStart) || contains(lineEnd)) {
          return true;
        } else if (boundary.intersects(lineStart, lineEnd)) {
          //SUGGEST (performance): use that the box is axis-aligned?
View Full Code Here

       
        for (MapOverlap<?,?> overlap : area.getOverlaps()) {
         
          if (overlap instanceof MapOverlapWA) {
           
            MapWaySegment waySegment = ((MapOverlapWA)overlap).e1;
           
            boolean isRidge = waySegment.getTags().contains("roof:ridge", "yes");
            boolean isEdge = waySegment.getTags().contains("roof:edge", "yes");
           
            if (!(isRidge || isEdge))
              continue;
           
            boolean inside = polygon.contains(waySegment.getCenter());

            // check also endpoints as pnpoly algo is not reliable when
            // segment lies on the polygon edge
            boolean containsStart = nodes.contains(waySegment.getStartNode());
            boolean containsEnd = nodes.contains(waySegment.getEndNode());

            if (!inside && !(containsStart && containsEnd))
              continue;

            if (isEdge)
              edges.add(waySegment);
            else
              ridges.add(waySegment);
           
            ridgeAndEdgeSegments.add(waySegment.getLineSegment());
          }
        }

        for (MapWaySegment waySegment : edges){
          for (MapNode node : waySegment.getStartEndNodes()) {

            // height of node (above roof base)
            Float nodeHeight = null;

            if (node.getTags().containsKey("roof:height")) {
              nodeHeight = parseMeasure(node.getTags()
                  .getValue("roof:height"));
            // hmm, shouldnt edges be interpolated? some seem to think they dont
            } else if (waySegment.getTags().containsKey("roof:height")) {
              nodeHeight = parseMeasure(waySegment.getTags()
                      .getValue("roof:height"));
            } else if (node.getTags().contains("roof:apex""yes")) {
              nodeHeight = (float)roofHeight;
            }

            if (nodeHeight == null) {
              nodeSet.add(node.getPos());
              continue;
            }
           
            roofHeightMap.put(node.getPos(), (double) nodeHeight);
           
            if (usePartRoofHeight)
              roofHeight = max(roofHeight, nodeHeight);
          }
        }
               
        for (MapWaySegment waySegment : ridges){
          // height of node (above roof base)
          Float nodeHeight = null;

          if (waySegment.getTags().containsKey("roof:height")) {
            nodeHeight = parseMeasure(waySegment.getTags()
                .getValue("roof:height"));
          } else {
            nodeHeight = (float) roofHeight;
          }

          if (usePartRoofHeight)
            roofHeight = max(roofHeight, nodeHeight);

          for (MapNode node : waySegment.getStartEndNodes())
              roofHeightMap.put(node.getPos(), (double) nodeHeight);
        }
       
        /* join colinear segments, but not the nodes that are connected to ridge/edges
         * often there are nodes that are only added to join one building to another
View Full Code Here

   
    /* entrances */
   
    if (node.getConnectedWaySegments().size() == 2) {
     
      MapWaySegment segmentA = node.getConnectedWaySegments().get(0);
      MapWaySegment segmentB = node.getConnectedWaySegments().get(1);
     
      if (isTunnel(segmentA) && !isTunnel(segmentB)
          && segmentA.getPrimaryRepresentation() instanceof AbstractNetworkWaySegmentWorldObject) {
       
        node.addRepresentation(new TunnelEntrance(node,
            (AbstractNetworkWaySegmentWorldObject)
            segmentA.getPrimaryRepresentation()));
       
      } else if (isTunnel(segmentB) && !isTunnel(segmentA)
          && segmentB.getPrimaryRepresentation() instanceof AbstractNetworkWaySegmentWorldObject) {
       
        node.addRepresentation(new TunnelEntrance(node,
            (AbstractNetworkWaySegmentWorldObject)
            segmentB.getPrimaryRepresentation()));
       
      }
     
    }
   
View Full Code Here

TOP

Related Classes of org.osm2world.core.map_data.data.MapWaySegment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.