Examples of RoadMappingU


Examples of org.movsim.roadmappings.RoadMappingU

        final double roadLength = roadMapping.roadLength();

        final Class<? extends RoadMapping> roadMappingClass = roadMapping.getClass();
        if (roadMappingClass == RoadMappingU.class) {
            final RoadMappingU mappingU = (RoadMappingU) roadMapping;
            final double straightLength = mappingU.straightLength();

            // draw the first straight
            posTheta = roadMapping.startPos(lateralOffset);
            from.setLocation(posTheta.x, posTheta.y);
            posTheta = roadMapping.map(straightLength, lateralOffset);
            to.setLocation(posTheta.x, posTheta.y);
            line.setLine(from, to);
            g.draw(line);

            // draw the second straight
            posTheta = roadMapping.map(roadLength - straightLength, lateralOffset);
            from.setLocation(posTheta.x, posTheta.y);
            posTheta = roadMapping.map(roadLength, lateralOffset);
            to.setLocation(posTheta.x, posTheta.y);
            line.setLine(from, to);
            g.draw(line);

            // draw the U
            posTheta = mappingU.startPos();
            final double radius = mappingU.radius();
            final Arc2D.Double arc2D = new Arc2D.Double();
            arc2D.setArcByCenter(posTheta.x - straightLength, posTheta.y + radius, radius + lateralOffset, 90.0, 180.0,
                    Arc2D.OPEN);
            g.draw(arc2D);
            return;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.