/[projects]/android/TrainInfoService/src/dk/thoerup/traininfoservice/RequestPlotter.java
ViewVC logotype

Diff of /android/TrainInfoService/src/dk/thoerup/traininfoservice/RequestPlotter.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 804 by torben, Mon Jun 7 12:01:42 2010 UTC revision 805 by torben, Mon Jun 7 18:26:09 2010 UTC
# Line 126  public class RequestPlotter extends Http Line 126  public class RequestPlotter extends Http
126          */                */      
127                                    
128    
129                    final String STYLE_GREEN = "green";
130                    final String STYLE_YELLOW = "yellow";
131                    final String STYLE_RED = "red";
132    
133                    String oldstyle = null;
   
   
134                  Date now = new Date();                  Date now = new Date();
135                  for(RequestPosition current : list) {                  for(RequestPosition current : list) {
136                                                    
# Line 137  public class RequestPlotter extends Http Line 138  public class RequestPlotter extends Http
138                          long timediff = now.getTime() - current.time.getTime();                          long timediff = now.getTime() - current.time.getTime();
139                                                    
140                          if ( timediff < (3*60*60*1000) ) {                          if ( timediff < (3*60*60*1000) ) {
141                                  style = "#red";                                  style = STYLE_RED;
142                          } else if ( timediff < (24*60*60*1000)) {                          } else if ( timediff < (24*60*60*1000)) {
143                                  style = "#yellow";                                  style = STYLE_YELLOW;
144                          } else {                          } else {
145                                  style = "#green";                                  style = STYLE_GREEN;
146                            }
147                            
148                            if (  !style.equals(oldstyle) ) {
149                                    if (oldstyle != null)                          
150                                            sb.append( "</Folder>\n");
151                                    sb.append( "<Folder>\n");
152                                    sb.append( " <name>" ).append(style).append("</name>\n");
153                                    
154                                    oldstyle = style;
155                          }                          }
156                                                    
157                          sb.append( " <Placemark>\n" );                          sb.append( " <Placemark>\n" );
158                          sb.append( "  <styleUrl>" + style + "</styleUrl>\n" );                          sb.append( "  <styleUrl>#" + style + "</styleUrl>\n" );
159                          sb.append( "  <description>IP=" + current.ip + "  Time=" + current.time + "</description>\n" );                          sb.append( "  <description>IP=" + current.ip + "  Time=" + current.time + "</description>\n" );
160                          sb.append( "  <Point><coordinates>" + current.lng + "," + current.lat + ",0</coordinates></Point>\n" );                          sb.append( "  <Point><coordinates>" + current.lng + "," + current.lat + ",0</coordinates></Point>\n" );
161                          sb.append( " </Placemark>\n" );                                          sb.append( " </Placemark>\n" );                
162                  }                  }
163                    sb.append( "</Folder>\n" );
164                  sb.append(  "</Document>\n" );                  sb.append( "</Document>\n" );
165                  sb.append( "</kml>\n" );                  sb.append( "</kml>\n" );
166    
167                  return sb.toString();                  return sb.toString();

Legend:
Removed from v.804  
changed lines
  Added in v.805

  ViewVC Help
Powered by ViewVC 1.1.20