Logo Search packages:      
Sourcecode: josm-plugins version File versions  Download package

org::openstreetmap::josm::plugins::ywms::ImageLoader::ImageLoader ( String  wmsUrl  )  throws ImageLoaderException [inline]

Constructor.

Parameters:
wmsUrl The WMS request
Exceptions:
ImageLoaderException When error loading the image

Definition at line 78 of file ImageLoader.java.

References getBbox(), height, load(), orig_bbox, width, and yahooUrl.

      {
            System.out.println("YWMS::Requested WMS URL: " + wmsUrl);
            try {
                  URI request = new URI("file:///page" + wmsUrl);
                  String query = request.getQuery().toLowerCase();
                  yahooUrl = new File(Util.getPluginDir(), "ymap.html").toURI();
                  yahooUrl = new URI( yahooUrl.toString() + "?" + query);
                  
                  // Parse query to find original bounding box and dimensions
            StringTokenizer st = new StringTokenizer(query, "&");
            while( st.hasMoreTokens() )
            {
                  String param = st.nextToken();
                  if( param.startsWith("width=") )
                        width=Integer.parseInt(param.substring("width=".length()));
                  else if( param.startsWith("height=") )
                        height=Integer.parseInt(param.substring("height=".length()));
                  else if( param.startsWith("bbox=") )
                  {
                        orig_bbox = getBbox(param);
                  }
            }
            
            if( width == -1 || height == -1)
                  throw new ImageLoaderException("Can't find dimensions");
            
            load();
            } 
            catch (URISyntaxException e) {
                  throw new ImageLoaderException(e);
            }
      }


Generated by  Doxygen 1.6.0   Back to index