/** * Initialize configuration options for WorldWind to operate correctly. * * @param globeTypeClass */ protected void initconfig(Class<? extends Globe> globeTypeClass) { // Configuration.setValue(AVKey.GLOBE_CLASS_NAME, EarthFlat.class.getName()); Configuration.setValue(AVKey.GLOBE_CLASS_NAME, globeTypeClass.getName()); Configuration.setValue(AVKey.VIEW_CLASS_NAME, FlatOrbitView.class.getName()); Configuration.setValue( AVKey.LAYERS_CLASS_NAMES, "gov.nasa.worldwind.layers.CompassLayer," + "gov.nasa.worldwind.layers.Earth.NASAWFSPlaceNameLayer," + "gov.nasa.worldwind.layers.Earth.CountryBoundariesLayer," + "gov.nasa.worldwind.layers.Earth.BMNGOneImage," + "gov.nasa.worldwind.layers.Earth.BMNGWMSLayer," + "gov.nasa.worldwind.layers.Earth.LandsatI3WMSLayer," + "gov.nasa.worldwind.layers.Earth.USGSUrbanAreaOrtho," + "gov.nasa.worldwind.layers.Earth.MSVirtualEarthLayer"); System.setProperty("java.net.useSystemProxies", "true"); if (Configuration.isMacOS()) { System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty( "com.apple.mrj.application.apple.menu.about.name", "World Wind Application"); System.setProperty("com.apple.mrj.application.growbox.intrudes", "false"); System.setProperty("apple.awt.brushMetalLook", "true"); } else if (Configuration.isWindowsOS()) { // Prevent flashing during window resizing System.setProperty("sun.awt.noerasebackground", "true"); } }
protected static String determineSingleUserLocation() { String home = getUserHomeDir(); if (home == null) { Logging.logger().warning("generic.UsersHomeDirectoryNotKnown"); return null; } String path = null; if (gov.nasa.worldwind.Configuration.isMacOS()) { path = "/Library/Caches"; } else if (gov.nasa.worldwind.Configuration.isWindowsOS()) { // This produces an incorrect path with duplicate parts, // like "C:\Users\PatC:\Users\Pat\Application Data". // path = System.getenv("USERPROFILE"); // if (path == null) // { // Logging.logger().fine("generic.UsersWindowsProfileNotKnown"); // return null; // } // path += "\\Application Data"; path = "\\Application Data"; } else if (gov.nasa.worldwind.Configuration.isLinuxOS() || gov.nasa.worldwind.Configuration.isUnixOS() || gov.nasa.worldwind.Configuration.isSolarisOS()) { path = "/var/cache/"; } else { Logging.logger().fine("generic.UnknownOperatingSystem"); } if (path == null) return null; return home + path; }
/** * Create a new WebView. * * @param frameSize The size of the WebView rectangle. * @throws UnsupportedOperationException if this class is instantiated on a non-Windows operating * system. * @throws WWRuntimeException if creating the native web browser window fails for any reason. For * example, because the process has run out of User Object handles (see documentation <a * href="#limits">above</a>). */ public WindowsWebView(Dimension frameSize) { if (frameSize == null) { String message = Logging.getMessage("nullValue.SizeIsNull"); Logging.logger().severe(message); throw new IllegalArgumentException(message); } if (!Configuration.isWindowsOS()) { String message = Logging.getMessage( "NativeLib.UnsupportedOperatingSystem", "Windows WebView", System.getProperty("os.name")); Logging.logger().severe(message); throw new UnsupportedOperationException(message); } this.frameSize = frameSize; try { // Increment the instance counter instances.incrementAndGet(); // Make sure that the message loop thread is running this.ensureMessageLoopRunning(); // Create the web view this.webViewWindowPtr = WindowsWebViewJNI.newWebViewWindow(webViewMessageLoop); if (this.webViewWindowPtr == 0) { String message = Logging.getMessage("WebView.NativeExceptionInitializingWebView"); Logging.logger().severe(message); throw new WWRuntimeException(message); } WindowsWebViewJNI.setFrameSize( this.webViewWindowPtr, this.frameSize.width, this.frameSize.height); this.observerPtr = WindowsWebViewJNI.newNotificationAdapter(this); WindowsWebViewJNI.addWindowUpdateObserver(this.webViewWindowPtr, observerPtr); } catch (RuntimeException e) { // If the WebView was not created successfully do not increment the instance counter. instances.decrementAndGet(); this.handleWebViewCreationError(); throw e; } catch (Error e) { // If the WebView was not created successfully do not increment the instance counter. instances.decrementAndGet(); this.handleWebViewCreationError(); throw e; } }
protected static String makeFullLibName(String libName) { if (WWUtil.isEmpty(libName)) return null; if (gov.nasa.worldwind.Configuration.isWindowsOS()) { if (!libName.toLowerCase().endsWith(".dll")) return libName + ".dll"; } else if (gov.nasa.worldwind.Configuration.isMacOS()) { if (!libName.toLowerCase().endsWith(".jnilib") && !libName.toLowerCase().startsWith("lib")) return "lib" + libName + ".jnilib"; } else if (gov.nasa.worldwind.Configuration.isUnixOS()) // covers Solaris and Linux { if (!libName.toLowerCase().endsWith(".so") && !libName.toLowerCase().startsWith("lib")) return "lib" + libName + ".so"; } return libName; }
protected static String determineAllUserLocation() { if (gov.nasa.worldwind.Configuration.isMacOS()) { return "/Library/Caches"; } else if (gov.nasa.worldwind.Configuration.isWindowsOS()) { String path = System.getenv("ALLUSERSPROFILE"); if (path == null) { Logging.logger().severe("generic.AllUsersWindowsProfileNotKnown"); return null; } return path + (Configuration.isWindows7OS() ? "" : "\\Application Data"); } else if (gov.nasa.worldwind.Configuration.isLinuxOS() || gov.nasa.worldwind.Configuration.isUnixOS() || gov.nasa.worldwind.Configuration.isSolarisOS()) { return "/var/cache/"; } else { Logging.logger().warning("generic.UnknownOperatingSystem"); return null; } }