Package org.osm2world.core.world.data

Examples of org.osm2world.core.world.data.WorldObject


   *
   * @param node  one of the nodes of {@link #segment}
   */
  private GroundState getGroundState(MapNode node) {
   
    WorldObject primaryWO = node.getPrimaryRepresentation();
   
    if (primaryWO != null) {
     
      return primaryWO.getGroundState();
     
    } else if (this.getGroundState() == ON) {
     
      return ON;
     
View Full Code Here


        if (connectedSegment != this.segment) {
          previousSegment = connectedSegment;
        }
      }
     
      WorldObject previousWO = previousSegment.getPrimaryRepresentation();
     
      if (previousWO instanceof AbstractNetworkWaySegmentWorldObject) {
       
        AbstractNetworkWaySegmentWorldObject previous =
            (AbstractNetworkWaySegmentWorldObject)previousWO;
View Full Code Here

     * at intersections */
   
    for (MapOverlap<?,?> overlap : segment.getOverlaps()) {
     
      MapElement other = overlap.getOther(segment);
      WorldObject otherWO = other.getPrimaryRepresentation();
     
      if (otherWO == null
          || otherWO.getGroundState() != ON//TODO remove the ground state check
        continue;
     
      boolean thisIsUpper = this.getGroundState() == ABOVE; //TODO check layers
     
      double distance = 10.0; //TODO base on clearing
     
      if (overlap instanceof MapIntersectionWW) {
       
        MapIntersectionWW intersection = (MapIntersectionWW) overlap;
       
        if (otherWO instanceof AbstractNetworkWaySegmentWorldObject) {
         
          AbstractNetworkWaySegmentWorldObject otherANWSWO =
              ((AbstractNetworkWaySegmentWorldObject)otherWO);
         
          EleConnector thisConn = primaryRep.getEleConnectors()
              .getConnector(intersection.pos);
          EleConnector otherConn = otherANWSWO.getEleConnectors()
              .getConnector(intersection.pos);
         
          if (thisIsUpper) {
            enforcer.requireVerticalDistance(
                MIN, distance, thisConn, otherConn);
          } else {
            enforcer.requireVerticalDistance(
                MIN, distance, otherConn, thisConn);
          }
         
        }
       
      } else if (overlap instanceof MapOverlapWA) {
       
        /*
         * require minimum distance at intersection points
         * (these have been inserted into this segment,
         * but not into the area)
         */
       
        MapOverlapWA overlapWA = (MapOverlapWA) overlap;
       
        if (overlap.type == MapOverlapType.INTERSECT
            && otherWO instanceof AbstractAreaWorldObject) {
         
          AbstractAreaWorldObject otherAAWO =
              ((AbstractAreaWorldObject)otherWO);
         
          for (int i = 0; i < overlapWA.getIntersectionPositions().size(); i++) {
           
            VectorXZ pos =
                overlapWA.getIntersectionPositions().get(i);
            MapAreaSegment areaSegment =
                overlapWA.getIntersectingAreaSegments().get(i);
           
            EleConnector thisConn = primaryRep.getEleConnectors()
                .getConnector(pos);
           
            EleConnector base1 = otherAAWO.getEleConnectors()
                .getConnector(areaSegment.getStartNode().getPos());
            EleConnector base2 = otherAAWO.getEleConnectors()
                .getConnector(areaSegment.getEndNode().getPos());
                       
            if (thisConn != null && base1 != null && base2 != null) {
             
              if (thisIsUpper) {
                enforcer.requireVerticalDistance(MIN, distance,
                    thisConn, base1, base2);
              } else {
                enforcer.requireVerticalDistance(MAX, -distance,
                    thisConn, base1, base2);
              }
             
            }
           
          }
         
        }
       
        /*
         * require minimum distance to the area's elevation connectors.
         * There is usually no direct counterpart for these in this segment.
         * Examples include trees on terrain above tunnels.
         */
       
        if (!(otherWO instanceof Forest)) continue; //TODO enable and debug for other WO classes
       
        eleConnectors:
        for (EleConnector c : otherWO.getEleConnectors()) {
         
          if (outlinePolygonXZ == null ||
              !outlinePolygonXZ.contains(c.pos))
            continue eleConnectors;
         
View Full Code Here

TOP

Related Classes of org.osm2world.core.world.data.WorldObject

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.