Examples of Road


Examples of com.jcloisterzone.feature.Road

        if (getTile().isAbbeyTile()) {
            scoreCompletedNearAbbey(pos);
        }

        if (tunnelCap != null) {
            Road r = tunnelCap.getPlacedTunnel();
            if (r != null) {
                scoreCompleted(r, true);
            }
        }
View Full Code Here

Examples of com.jcloisterzone.feature.Road

        }
    }

    private void processRoadElement(String[] sides, Element e, boolean isTunnelActive) {
        //Road road = new Road(tile, sides.length, sides.length == 1 && attributeBoolValue(e, "tunnel"));
        Road road = new Road();
        road.setId(game.idSequnceNextVal());
        if (isTunnelActive && attributeBoolValue(e, "tunnel")) {
            road.setTunnelEnd(Road.OPEN_TUNNEL);
        }
        initFromDirList(road, sides);
        game.initFeature(tile, road, e);
    }
View Full Code Here

Examples of com.jcloisterzone.feature.Road

    }

    @Override
    public void initFeature(Tile tile, Feature feature, Element xml) {
        if (!(feature instanceof Road)) return;
        Road road = (Road) feature;
        if (road.isTunnelEnd()) {
            tunnels.add(road);
        }
    }
View Full Code Here

Examples of com.jcloisterzone.feature.Road

    private int getTunnelId(Player p, boolean isB) {
        return p.getIndex() + (isB ? 100 : 0);
    }

    public void placeTunnelPiece(Position p, Location loc, boolean isB) {
        Road road = (Road) getBoard().get(p).getFeature(loc);
        if (!road.isTunnelOpen()) {
            throw new IllegalStateException("No open tunnel here.");
        }
        placedTunnelCurrentTurn = road;
        Player player = game.getActivePlayer();
        placeTunnelPiece(road, player, p, loc, isB);
View Full Code Here

Examples of com.jcloisterzone.feature.Road

        nl = node.getElementsByTagName("tunnel");
        for (int i = 0; i < nl.getLength(); i++) {
            Element el = (Element) nl.item(i);
            Position pos = XmlUtils.extractPosition(el);
            Location loc = Location.valueOf(el.getAttribute("location"));
            Road road = (Road) getBoard().get(pos).getFeature(loc);
            if (!road.isTunnelEnd()) {
                logger.error("Tunnel end does not exist.");
                continue;
            }
            Player player = game.getPlayer(Integer.parseInt(el.getAttribute("player")));
            boolean isB = "yes".equals(el.getAttribute("b"));
View Full Code Here

Examples of com.lbslocal.cc.objects.v4.addressFinder.Road

            for (int intI = pg.getRecordsInitial(); intI <= pg.getRecordsFinal(); intI++) {
              if (rs1.absolute(intI)) {
                // classe road
                rl[iCount] = new RoadLocation();
                rl[iCount].setRoad(new Road());
                rl[iCount].getRoad().setName(rs1.getString("ENDERECO"));
                rl[iCount].getRoad().setRoadNumber(rs1.getString("NUMERO"));

                rl[iCount].getRoad().setCity(new City());
                rl[iCount].getRoad().getCity().setName(rs1.getString("MUNICIPIO"));
View Full Code Here

Examples of com.supercookie.deathrace.road.Road

        setScreen(new Screen() {

            private final Stage stage = new Stage(new StretchViewport(GAME_VIEWPORT_WIDTH, GAME_VIEWPORT_HEIGHT));
            private final BitmapFont bitmapFont = new BitmapFont();
            private final Label fps = new Label("", new Label.LabelStyle(bitmapFont, Color.WHITE));
            private final Road road = new Road();

            @Override
            public void render(float v) {
                GL20 gl = Gdx.graphics.getGL20();
                gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
                fps.setText("" + Gdx.graphics.getFramesPerSecond());

                road.update(v);
                road.render(stage.getCamera());

                stage.act();
                stage.draw();
            }

            @Override
            public void resize(int i, int i2) {

            }

            @Override
            public void show() {
                fps.setFontScale(5F);
                stage.addActor(fps);
                road.resetRoad();
            }

            @Override
            public void hide() {
View Full Code Here

Examples of org.movsim.network.autogen.opendrive.OpenDRIVE.Road

                        roadNetwork.findByUserId(connection.getIncomingRoad()), "Cannot find incoming road: "
                                + connection.getIncomingRoad());
                RoadSegment connenctingRoadSegment = Preconditions.checkNotNull(
                        roadNetwork.findByUserId(connection.getConnectingRoad()), "Cannot find connecting road: "
                                + connection.getConnectingRoad());
                Road road = findByUserId(openDriveNetwork.getRoad(), connection.getConnectingRoad());
                if (roadPredecessorIsJunction(junction, road)) {
                    for (final LaneLink laneLink : connection.getLaneLink()) {
                        final int fromLane = OpenDriveHandlerUtils.laneIdToLaneIndex(incomingRoadSegment,
                                laneLink.getFrom());
                        final int toLane = OpenDriveHandlerUtils.laneIdToLaneIndex(connenctingRoadSegment,
View Full Code Here

Examples of trafficjams.model.classes.Road

        float gorLength = Numbers.mapWidth / (float)crossCount /*- 2*/ ;
        float vertLength = Numbers.mapHeight / (float) crossCount /*- 2*/ ;
        ICrossRoad[][] a_crossRoads= new ICrossRoad[crossCount][crossCount];
        ArrayList<ICrossRoad> l_crossRoads = new ArrayList<ICrossRoad>(crossCount*crossCount);
        ArrayList<IRoad> roads = new ArrayList<IRoad>();
        Road r = null;

        //создаем перекрестки и дороги ввиде сетки, уже смещенной
        for (int i = 0 ; i<crossCount; ++i){
            if (i==0){
                for (int j = 0 ; j < crossCount; ++j){
                    CrossRoad currCross = new CrossRoad(retVal);
                    l_crossRoads.add(currCross);
                    currCross.setCoord(new Point(gorLength*i + gorLength*rand(), vertLength*j + vertLength * rand()));
                    a_crossRoads[i][j] = currCross;
                    if (j==0){
                        continue;
                    }
                    r = new Road(retVal);
                    roads.add(r);
                    r.setFCross(a_crossRoads[i][j-1]);
                    r.setLCross(currCross);

                    ((CrossRoad)a_crossRoads[i][j-1]).setRoadForDirection(r, right);
                    currCross.setRoadForDirection(r, left);

                }
                continue;
            }

            for (int j = 0 ; j < crossCount; ++j){
                CrossRoad currCross = new CrossRoad(retVal);
                l_crossRoads.add(currCross);
                currCross.setCoord(new Point(gorLength*i + gorLength*rand(), vertLength*j + vertLength * rand()));
                a_crossRoads[i][j] = currCross;
                r = new Road(retVal);
                roads.add(r);
                r.setFCross(a_crossRoads[i-1][j]);
                r.setLCross(currCross);
                ((CrossRoad)a_crossRoads[i-1][j]).setRoadForDirection(r, down);
                currCross.setRoadForDirection(r, up);
                if (j==0){
                    continue;
                }
                r = new Road(retVal);
                roads.add(r);
                r.setFCross(a_crossRoads[i][j-1]);
                r.setLCross(currCross);

                ((CrossRoad)a_crossRoads[i][j-1]).setRoadForDirection(r, right);
                currCross.setRoadForDirection(r, left);

            }
        }

        //убиваем координаты выходящие за границы(выставляем в границы)
        this.removeNegatives(l_crossRoads);

        //выбираем дороги для уничтожения
        ArrayList<IRoad> toDelete = new ArrayList<IRoad>();
        for (IRoad __r : roads){
            if (Math.random()<Numbers.percent){
                toDelete.add(__r);
            }
        }

        //удаляем дороги
        for (IRoad __r : toDelete){
            if (!roads.remove(__r))
                throw new Exception("дорога не удалилась!");
            Road _r = (Road) __r;
            ((CrossRoad)_r.getFCross()).deleteRoad(_r);
            ((CrossRoad)_r.getLCross()).deleteRoad(_r);
        }

        //удаляем перекрестки в которые входят 0 или 2 дороги (и соединяем дорогий то что разъединилось)
        for (int i = 0 ; i<crossCount ; ++i){
            for (int j = 0 ; j<crossCount; ++j){
                CrossRoad cr = (CrossRoad) a_crossRoads[i][j];
                if (cr.getType()  == 0){
                    if (!l_crossRoads.remove(a_crossRoads[i][j]))
                        throw new Exception("перекресток не удалился!");
                    a_crossRoads[i][j] = null;
                }
                if (cr.getType()  == 2){
                    if (!l_crossRoads.remove(a_crossRoads[i][j]))
                        throw new Exception("перекресток не удалился!");
                    a_crossRoads[i][j] = null;
                    IRoad[] rd = cr.get2Roads();
                    CrossRoad c0 = (CrossRoad)((Road)rd[0]).getOtherEnd(cr);
                    CrossRoad c1 = (CrossRoad)((Road)rd[1]).getOtherEnd(cr);

                    if (!(roads.remove(rd[0]) && roads.remove(rd[1])))
                        throw new Exception("road remove error");

                    IRoad newRoad = this.createConnector(c0,c1);
                    roads.add(newRoad);
                    ((CrossRoad) c0).setRoadForDirection(newRoad, c0.deleteRoad(rd[0]));
                    ((CrossRoad) c1).setRoadForDirection(newRoad, c1.deleteRoad(rd[1]));
                }
            }
        }

        //проверяем на связность
        if (!this.isCorrect(l_crossRoads, roads, tryCount)){
            return this.makeRoadMap(crossCount,autoCount,--tryCount);
        }

        //проверяем перекрестки и инициализируем очереди
        for (ICrossRoad iCrossRoad: l_crossRoads){
            CrossRoad crossRoad = (CrossRoad) iCrossRoad;
            if (crossRoad.getType()==2){
                return this.makeRoadMap(crossCount, autoCount, --tryCount);
            }
            crossRoad.initQueues();
        }

        ///выставляем длины дорог
        float maxLength = 0;
        float minLength = Math.max(Numbers.mapHeight, Numbers.mapWidth);
        for (IRoad __r : roads){
            Road _r = (Road)__r;
            float l = 0;
            float x1 = _r.getFCross().getCoord().getX();
            float x2 = _r.getLCross().getCoord().getX();
            float y1 = _r.getFCross().getCoord().getY();
            float y2 = _r.getLCross().getCoord().getY();
            l = (float) Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
            _r.setLength(l);
            if (l>maxLength){
                maxLength = l;
            }
            if (l<minLength){
                minLength = l ;
View Full Code Here

Examples of trafficjams.model.classes.Road

            cr.setCoord(p);
        }
    }

    private IRoad createConnector(ICrossRoad c0, ICrossRoad c1) {
        Road retVal = new Road(c0.getMap());
        if (c0.getCoord().getY()<c1.getCoord().getY()){
            retVal.setFCross(c0);
            retVal.setLCross(c1);
        }else {
            if (c0.getCoord().getX()<c1.getCoord().getX()){
                retVal.setFCross(c0);
                retVal.setLCross(c1);
            }else {
                retVal.setFCross(c1);
                retVal.setLCross(c0);
            }
        }
        return retVal;
    }
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.