private static Color byIdColoringScheme(AgentSnapshotInfo agInfo) { String idstr = agInfo.getId().toString() ; int val = 8 ; if ( idstr.hashCode()%val==0 ) { return Color.red ; } else if (idstr.hashCode()%val==1 ) { return Color.orange ; } else if (idstr.hashCode()%val==2 ) { return Color.yellow ; } else if (idstr.hashCode()%val==3 ) { return Color.green ; } else if (idstr.hashCode()%val==4 ) { return Color.blue ; } else if (idstr.hashCode()%val==5 ) { return Color.cyan ; } else if (idstr.hashCode()%val==6 ) { return Color.magenta ; } else if (idstr.hashCode()%val==7 ) { return Color.pink ; } else { return Color.black; } }
private static Color taxicabColoringScheme(AgentSnapshotInfo agInfo) { // ===============TAXI COLOURING=============== if (agInfo.getId().toString().startsWith("taxi")) { if (agInfo.getAgentState() == AgentState.PERSON_DRIVING_CAR) { return Color.YELLOW ; } else { return Color.BLACK ; } } else { //===============REGULAR COLOURING=============== return standardColoringScheme( agInfo ) ; } }
@Override public void addAgent(AgentSnapshotInfo position) { //drop all parking vehicles if (position.getAgentState() == AgentSnapshotInfo.AgentState.PERSON_AT_ACTIVITY) return; String buffer = position.getId().toString() + "\t" + (int)this.currentTime + "\t0\t0\t1\t0\t" + position.getColorValueBetweenZeroAndOne() // link(0), from node(0), lane(1), dist(0), speed + "\t1\t0\t" + position.getId().toString() // vehtype(1), acceleration(0), driver-id + "\t0\t" + position.getEasting() // # of passengers(0), easting + "\t" + position.getNorthing() + "\t0" // elevation + "\t0" // azimuth + "\t"+ "0" + "\n"; // user(0) try { out.write(buffer); } catch (IOException e) { e.printStackTrace(); } }
private Color bvg2ColoringScheme(AgentSnapshotInfo agInfo) { if ( bvg2cnt < 1 ) { bvg2cnt++ ; Logger.getLogger(this.getClass()).info( "using bvg2 coloring scheme ...") ; } if ( agInfo.getAgentState()==AgentState.PERSON_DRIVING_CAR ) { return Color.DARK_GRAY; } else if ( agInfo.getAgentState()==AgentState.PERSON_AT_ACTIVITY ) { return Color.ORANGE; } else if ( agInfo.getAgentState()==AgentState.TRANSIT_DRIVER ) { String idstr = agInfo.getId().toString(); if ( idstr.contains("line_") && idstr.contains("-B-") ) { return Color.MAGENTA; } else if ( idstr.contains("line_") && idstr.contains("-T-")) { return Color.RED; } else if ( idstr.contains("line_SB")) { return Color.GREEN; } else if ( idstr.contains("line_U")) { return Color.BLUE; } else { return Color.ORANGE; } } else { return Color.YELLOW; } }
private static Color bvgColoringScheme(AgentSnapshotInfo agInfo) { if ( agInfo.getAgentState()==AgentState.PERSON_DRIVING_CAR ) { return Color.DARK_GRAY; } else if ( agInfo.getAgentState()==AgentState.PERSON_AT_ACTIVITY ) { return Color.ORANGE; } else if ( agInfo.getAgentState()==AgentState.TRANSIT_DRIVER ) { String idstr = agInfo.getId().toString(); if ( idstr.endsWith("_B") ) { return Color.MAGENTA; } else if ( idstr.endsWith("_T") ) { return Color.RED; } else if ( idstr.endsWith("_S")) { return Color.GREEN; } else if ( idstr.endsWith("_U")) { return Color.BLUE; } else { return Color.ORANGE; } } else { return Color.YELLOW; } }
private static Color gtfsColoringScheme(AgentSnapshotInfo agInfo) { if ( agInfo.getAgentState()==AgentState.PERSON_DRIVING_CAR ) { return Color.DARK_GRAY; } else if ( agInfo.getAgentState()==AgentState.PERSON_AT_ACTIVITY ) { return Color.ORANGE; } else if ( agInfo.getAgentState()==AgentState.TRANSIT_DRIVER ) { String idstr = agInfo.getId().toString(); if ( idstr.endsWith("bus") ) { return Color.MAGENTA; } else if ( idstr.endsWith("tram") ) { return Color.RED; } else if ( idstr.endsWith("rail")) { return Color.GREEN; } else if ( idstr.endsWith("subway")) { return Color.BLUE; } else { return Color.ORANGE; } } else { return Color.YELLOW; } }
private static void writeAgent(AgentSnapshotInfo agInfo, ByteBuffer out) { String id = agInfo.getId().toString(); ByteBufferUtils.putString(out, id); Point2D.Double point = OTFServerQuadTree.transform(new Coord(agInfo.getEasting(), agInfo.getNorthing())); out.putFloat((float) point.getX()); out.putFloat((float) point.getY()); out.putInt(agInfo.getAgentState().ordinal() ) ; out.putInt(agInfo.getUserDefined()); out.putFloat((float)agInfo.getColorValueBetweenZeroAndOne()); }
private static void writeAgent(AgentSnapshotInfo pos, ByteBuffer out) { String id = pos.getId().toString(); ByteBufferUtils.putString(out, id); Point2D.Double point = OTFServerQuadTree.transform(new Coord(pos.getEasting(), pos.getNorthing())); out.putFloat((float) point.getX()); out.putFloat((float) point.getY()); out.putInt(pos.getUserDefined()); out.putFloat((float) pos.getColorValueBetweenZeroAndOne()); out.putInt(pos.getAgentState().ordinal()); }
this.id2coord.put(Arrays.hashCode(agInfo.getId().toString().toCharArray()),this.count);