public YandexTrafficOverlay(Context ctx, OpenStreetMapView mapView) { if (OpenStreetMapViewConstants.DEBUGMODE) Log.d("RMAPS-Me", "YandexTrafficOverlay Constructor is Called"); mMapView = mapView; mRendererInfo = new OpenStreetMapRendererInfo(ctx.getResources(), "yandextraffic"); mRendererInfo.LoadFromResources("yandextraffic", null); DisplayMetrics metrics = new DisplayMetrics(); ((Activity) ctx).getWindowManager().getDefaultDisplay().getMetrics(metrics); int OpenStreetMapTileCacheSize = 10; if (metrics.heightPixels > 480 || metrics.widthPixels > 480) OpenStreetMapTileCacheSize = 20; mTileProvider = new OpenStreetMapTileProvider( ctx, new SimpleInvalidationHandler(), mRendererInfo, OpenStreetMapTileCacheSize); }
@Override public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException { if (localName.equalsIgnoreCase(MAP)) { if (mRendererInfo != null) { if (attributes.getValue(ID).equalsIgnoreCase(mMapId)) { mRendererInfo.ID = attributes.getValue(ID); mRendererInfo.NAME = attributes.getValue(NAME); mRendererInfo.BASEURL = attributes.getValue(BASEURL); mRendererInfo.ZOOM_MINLEVEL = Integer.parseInt(attributes.getValue(ZOOM_MINLEVEL)); mRendererInfo.ZOOM_MAXLEVEL = Integer.parseInt(attributes.getValue(ZOOM_MAXLEVEL)); mRendererInfo.IMAGE_FILENAMEENDING = attributes.getValue(IMAGE_FILENAMEENDING); mRendererInfo.MAPTILE_SIZEPX = Integer.parseInt(attributes.getValue(MAPTILE_SIZEPX)); mRendererInfo.URL_BUILDER_TYPE = Integer.parseInt(attributes.getValue(URL_BUILDER_TYPE)); mRendererInfo.TILE_SOURCE_TYPE = Integer.parseInt(attributes.getValue(TILE_SOURCE_TYPE)); mRendererInfo.PROJECTION = Integer.parseInt(attributes.getValue(PROJECTION)); mRendererInfo.YANDEX_TRAFFIC_ON = Integer.parseInt(attributes.getValue(YANDEX_TRAFFIC_ON)); mRendererInfo.LAYER = false; if (attributes.getIndex(LAYER) > -1) mRendererInfo.LAYER = Boolean.parseBoolean(attributes.getValue(LAYER)); mRendererInfo.CACHE = ""; if (attributes.getIndex(CACHE) > -1) mRendererInfo.CACHE = attributes.getValue(CACHE); } } else if (mSubmenu != null) { final int i = attributes.getIndex(LAYER); if (mSharedPreferences.getBoolean( MainPreferences.PREF_PREDEFMAPS_ + attributes.getValue(ID), true) && (i == -1 || !attributes.getValue(LAYER).equalsIgnoreCase(TRUE))) { final MenuItem item = mSubmenu.add(attributes.getValue(NAME)); item.setTitleCondensed(attributes.getValue(ID)); } } else if (mPrefMapsgroup != null) { final int i = attributes.getIndex(LAYER); if (i == -1 || !attributes.getValue(LAYER).equalsIgnoreCase(TRUE)) { CheckBoxPreference pref = new CheckBoxPreference(mPrefActivity); pref.setKey(MainPreferences.PREF_PREDEFMAPS_ + attributes.getValue(ID)); pref.setTitle(attributes.getValue(NAME)); pref.setSummary(attributes.getValue(DESCR)); // [email protected] this does set the pref on the pref page to not checked, but // cancels out any effect of behavior (they still show up, and checking them changes // nothing) pref.setDefaultValue(true); mPrefMapsgroup.addPreference(pref); } } } super.startElement(uri, localName, name, attributes); }