Android Open Source - g3m_owm G3 M O W M Builder






From Project

Back to project page g3m_owm.

License

The source code is released under:

Copyright (c) 2013, Glob3 Mobile, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are m...

If you think the Android project g3m_owm listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.glob3.mobile.owm.shared;
/*from   w  w w.j ava 2 s .c  om*/
import java.util.ArrayList;

import org.glob3.mobile.generated.Color;
import org.glob3.mobile.generated.IG3MBuilder;
import org.glob3.mobile.generated.LayerSet;
import org.glob3.mobile.generated.MarksRenderer;
import org.glob3.mobile.generated.Quality;

import com.glob3.mobile.owm.shared.data.SimpleRasterLayerBuilder;


public class G3MOWMBuilder {

   static IG3MBuilder               _builder;
   static G3MOWMListener            _listener;
   static Platform                  _platform;
   private static LayerSet          _layerset;
   private static MarksRenderer     _weatherMarksRenderer;
   private static ArrayList<String> _baseLayers;
   private static ArrayList<String> _weatherLayers;

   public static enum Platform {
      ANDROID,
      WEB_GL,
   }


   public static void buildG3MOWM(final IG3MBuilder builder,
                                  final G3MOWMListener listener,
                                  final Platform platform) {


      _builder = builder;
      _listener = listener;
      _platform = platform;

      _builder.setBackgroundColor(Color.fromRGBA255(175, 221, 233, 255));
      _builder.getPlanetRendererBuilder().setQuality(Quality.QUALITY_HIGH);
      _weatherMarksRenderer = new MarksRenderer(false);
      _builder.addRenderer(_weatherMarksRenderer);
      configureLayers();

   }


   public static LayerSet getLayerset() {
      return _layerset;
   }


   public static ArrayList<String> getBaseLayerList() {
      _baseLayers = new ArrayList<String>();
      _baseLayers.add("Bing Aerial");
      _baseLayers.add("MapQuest OSM");
      _baseLayers.add("Map Box Terrain");
      _baseLayers.add("Map Box Aerial");
      _baseLayers.add("Bing Aerial With Labels");
      return _baseLayers;
   }


   public static void disableAllBaseLayers() {
      for (final String layerTitle : _baseLayers) {
         _layerset.getLayerByTitle(layerTitle).setEnable(false);
      }
   }


   public static void disableAllWeatherLayers() {
      for (final String layerTitle : _weatherLayers) {
         if (!layerTitle.equals("None")) {
            _layerset.getLayerByTitle(layerTitle).setEnable(false);
         }
      }
   }


   public static ArrayList<String> getWeatherLayerList() {
      _weatherLayers = new ArrayList<String>();
      _weatherLayers.add("None");
      _weatherLayers.add("Clouds");
      _weatherLayers.add("Precipitation");
      // _weatherLayers.add("Precipitation 3h global yr.no");
      _weatherLayers.add("Pressure");
      _weatherLayers.add("Pressure Contour");
      _weatherLayers.add("Surface pressure Contour yr.no");
      _weatherLayers.add("Wind");
      _weatherLayers.add("Wind 10m global yr.no");
      _weatherLayers.add("Temperature");
      _weatherLayers.add("Temperature 2m global yr.no");
      _weatherLayers.add("Snow");
      return _weatherLayers;
   }


   private static void configureLayers() {
      _layerset = SimpleRasterLayerBuilder.createLayerset();
      _layerset.getLayerByTitle("Bing Aerial").setEnable(true);
      _builder.getPlanetRendererBuilder().setLayerSet(_layerset);
   }


   public static MarksRenderer getWeatherMarkerLayer() {
      // TODO Auto-generated method stub
      return _weatherMarksRenderer;
   }


   public static void enableLayer(final String text) {
      if (text.equals("Pressure Contour")) {
         _layerset.getLayerByTitle(text).setEnable(true);
         _layerset.getLayerByTitle("Pressure").setEnable(true);
      }
      else

      if (!text.equals("None")) {
         _layerset.getLayerByTitle(text).setEnable(true);
      }

   }
}




Java Source Code List

com.glob3.mobile.owm.DataSourceAdapter.java
com.glob3.mobile.owm.Dialogs.java
com.glob3.mobile.owm.G3MOWMMainActivity.java
com.glob3.mobile.owm.GPSTracker.java
com.glob3.mobile.owm.Prefs.java
com.glob3.mobile.owm.SettingsActivity.java
com.glob3.mobile.owm.shared.G3MOWMBuilder.java
com.glob3.mobile.owm.shared.G3MOWMListener.java
com.glob3.mobile.owm.shared.data.DataRetriever.java
com.glob3.mobile.owm.shared.data.DialogDataListener.java
com.glob3.mobile.owm.shared.data.Place.java
com.glob3.mobile.owm.shared.data.Places.java
com.glob3.mobile.owm.shared.data.SimpleRasterLayerBuilder.java
com.glob3.mobile.owm.shared.data.Utils.java
com.glob3.mobile.owm.shared.data.WeatherForecastParser.java
com.glob3.mobile.owm.shared.data.WeatherForecast.java
com.glob3.mobile.owm.shared.data.Weather.java